command_result variable get database record while could be multi-line.

The below helps me loop over each record of the database.

   - debug:
       msg: "This is a database line: {{ item }}"
     with_items: "{{ command_result.stdout_lines }}"

What I now need is to trigger a fresh play like below for each loop 
iteration and its values.

- hosts: "{{ item.stdout.split('\t')[0] }}"
  tasks:
    - name: Check if reboot is required
      shell: /home/ansible/scripts/check.sh "{{ item.stdout.split('\t')[1] 
}}" 
      register: output


    - debug: var=output.stdout_lines


   - add_host: name={{ item }}
               groups=dest_nodes
               ansible_user={{ USER }}
     with_items: "{{ dest_ip.split(',') }}"

The item value will change on each loop and that will be fed to the play 
above. 

Can you please guide me how to achieve this ?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6a730169-fd2b-4a34-836e-2addb50d8490%40googlegroups.com.

Reply via email to