Host differ each run. The task will be included in a role.
Is it possible to do something like:

when: variable.stdout == "false"

Register: myVar


Task: a task

Shell: echo

When: myVar is defined
Delegate_to: "{{ first-host-where_myVar is defined }}"


On Thursday, December 15, 2016 at 12:18:23 PM UTC+1, Greg Langford wrote:
>
> Will the host be the same on each run?
>
> If so you could put a guard round the task when ansible_inventory_hostname 
> is equal to the desired host.
>
> when: ansible_inventory_hostname == "desired-host-name"
>
> Something like the above? Or maybe you could look into using delegated 
> tasks http://docs.ansible.com/ansible/playbooks_delegation.html#delegation
>
> Kind Regards
>
> On Thursday, 15 December 2016 08:01:14 UTC, Kevin Csuka wrote:
>>
>> Sorry if my message was unclear. The goal is to perform 'othertask' on 
>> only ONE host, where the value is false.
>> Your script will execute 'othertask' on ALL the hosts where the value is 
>> false, in this case, TWO hosts.
>>
>> Also, run_once will not work because it will only run on the first host, 
>> where the boolean is true.
>>
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4bf9778c-a8f1-4550-b71b-a4df0e5e132e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to