On 9/23/19 2:50 PM, Mohtashim S wrote:
> 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:Checkifreboot isrequired
>       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 ?

What do you mean with "trigger a fresh play" ?

Regards
          Racke

> 
> -- 
> 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] 
> <mailto:[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
> <https://groups.google.com/d/msgid/ansible-project/6a730169-fd2b-4a34-836e-2addb50d8490%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/3e64190e-f515-d9a4-21a6-4f69df494dfd%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to