Is there a way to set a variable in a task such that it has global scope?
I want to do something like this:
- hosts: all
serial: 1
vars:
foo_first_host: True
tasks:
- name: pause after the first host (expect "skipping" for subsequent
hosts)
pause:
prompt: Pausing after the first host; hit return to do the rest
when: foo_first_host
- set_fact:
foo_first_host: False
The problem is that set_fact seems to set the variable only in the current
host, which means that when the next host runs, the variable isn't set any
more. http://docs.ansible.com/ansible/set_fact_module.html says it right
there: "Variables are set on a host-by-host basis just like facts
discovered by the setup module."
Is there some other way to do what I'm trying to do there? I can think of
some other ideas, like using add_host to add a host to a group, and test
if the group is empty, but that seems sort of hokey.
-Josh (jbs@care.com)
(apologies for the automatic corporate disclaimer that follows)
This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.