BC> you can still access it via hostvars['hostitwassetin']['foo_first_host']

Ja, but how do I know (when I'm the second host) who the first host was?

In my actual use case, I'm doing things like restarting a cluster of
appservers, and I want to pause after the first, and then just do the rest
without further prompting (but one at a time, so I don't want the
(otherwise super cool) new serial: [1, "100%"] business).

FWIW, the add_host trick seems to work:

  - hosts: all
    serial: 1

    tasks:

      - debug: var=groups['foo_completed_hosts']

      - 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_completed_hosts' not in groups"

      - add_host: name={{ inventory_hostname }} groups=foo_completed_hosts

So, if there's not a way to set a global variable, the add_host way seems ok.

                                      -Josh ([email protected])

(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.

-- 
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/22571.24499.779569.315046%40gargle.gargle.HOWL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to