http://docs.ansible.com/ansible/set_fact_module.html
- name: set fact from hosts output
set_fact:
docker_manager: manager.stdout
docker_worker: worker.stdout
# you may want to just pick out a line too, see the debug for what you may
want
- debug:
var:
- worker.stdout_lines
- manager.stdout_lines
On 6 August 2016 at 08:15, Tony Owens <[email protected]> wrote:
> I'm looking for some tips on the best way to store a variable persistently
> across all hosts or multiple plays.
>
> I am attempting to create a docker swarm manager using something similar
> to this:
>
>
> 1. - hosts: swarm-init
> 2. gather_facts: no
> 3. tasks:
> 4. - shell: docker swarm init
> 5. - shell: docker swarm join-token -q manager
> 6. register: manager
> 7. - shell: docker swarm join-token -q worker
> 8. register: worker
>
>
> I would run this play once and don't have that logic built yet but I have
> not been able to find a method of storing {{ worker }} in a variable so
> that I could join the swarm from another host in another play. Any advice?
>
> --
> 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/43c19f78-9572-4af2-8e52-784878805bcc%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/43c19f78-9572-4af2-8e52-784878805bcc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Steve
--
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/CA%2BemtqsYXofm7qU6DZgdF%2BEiuyDXq1Erdb6uvY22Axrg3fMxjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.