How to save ansible stdout.lines to a file is in list format

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Need help in saving std.out lines to a file in delegated host using below playbook.
I am able to save the data, but the saved data is in json format. I need this data as list format as like command output.



- name: Host Collection
hosts: rcht01
tasks:
- name: Host coll
shell: mysql -ulnx -plnx -D inventory -se "select Host_Name from servers where OS= 'Linux' AND Server_Status = 'Live' AND Server_loc = 'Richardson' "| tr 'A-Z' 'a-z'
register: all_hosts_list

- name: Saving data to local file
copy:
content: " all_hosts_list.stdout_lines "
dest: /tmp/host_coll
delegate_to: rchabs01






share|improve this question

























    up vote
    1
    down vote

    favorite












    Need help in saving std.out lines to a file in delegated host using below playbook.
    I am able to save the data, but the saved data is in json format. I need this data as list format as like command output.



    - name: Host Collection
    hosts: rcht01
    tasks:
    - name: Host coll
    shell: mysql -ulnx -plnx -D inventory -se "select Host_Name from servers where OS= 'Linux' AND Server_Status = 'Live' AND Server_loc = 'Richardson' "| tr 'A-Z' 'a-z'
    register: all_hosts_list

    - name: Saving data to local file
    copy:
    content: " all_hosts_list.stdout_lines "
    dest: /tmp/host_coll
    delegate_to: rchabs01






    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Need help in saving std.out lines to a file in delegated host using below playbook.
      I am able to save the data, but the saved data is in json format. I need this data as list format as like command output.



      - name: Host Collection
      hosts: rcht01
      tasks:
      - name: Host coll
      shell: mysql -ulnx -plnx -D inventory -se "select Host_Name from servers where OS= 'Linux' AND Server_Status = 'Live' AND Server_loc = 'Richardson' "| tr 'A-Z' 'a-z'
      register: all_hosts_list

      - name: Saving data to local file
      copy:
      content: " all_hosts_list.stdout_lines "
      dest: /tmp/host_coll
      delegate_to: rchabs01






      share|improve this question













      Need help in saving std.out lines to a file in delegated host using below playbook.
      I am able to save the data, but the saved data is in json format. I need this data as list format as like command output.



      - name: Host Collection
      hosts: rcht01
      tasks:
      - name: Host coll
      shell: mysql -ulnx -plnx -D inventory -se "select Host_Name from servers where OS= 'Linux' AND Server_Status = 'Live' AND Server_loc = 'Richardson' "| tr 'A-Z' 'a-z'
      register: all_hosts_list

      - name: Saving data to local file
      copy:
      content: " all_hosts_list.stdout_lines "
      dest: /tmp/host_coll
      delegate_to: rchabs01








      share|improve this question












      share|improve this question




      share|improve this question








      edited May 18 at 18:30
























      asked May 18 at 18:13









      Pandu

      2616




      2616

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f444677%2fhow-to-save-ansible-stdout-lines-to-a-file-is-in-list-format%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f444677%2fhow-to-save-ansible-stdout-lines-to-a-file-is-in-list-format%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)