--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/43c19f78-9572-4af2-8e52-784878805bcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- - hosts: swarm-init
- tasks:
- - shell: docker swarm init
- - shell: docker swarm join-token -q manager
- register: manager
- - set_fact:
- manager: "{{ manager.stdout_lines }}"
- - shell: docker swarm join-token -q worker
- register: worker
- - set_fact:
- worker: "{{ worker.stdout_lines }}"
- - hosts: swarm-worker
- vars:
- key: "{{ hostvars[groups['swarm-init'][0]]['worker'] }}"
- tasks:
- - shell: "docker swarm join --token {{ key }} {{ swarmmanager }}:2377"
Inventory
- [swarm-init]
- myhost1
- [swarm-manager]
- myhost1
- [swarm-worker]
- myhost2
- [swarm-manager:vars]
- swarmmanager=myhost1
- [swarm-worker:vars]
- swarmmanager=myhost1
The output:PLAY *************************************************************************** TASK [setup] ******************************************************************* ok: [myhost1] TASK [command] ***************************************************************** changed: [myhost1] TASK [command] *****************************************************************changed: [myhost1] TASK [set_fact] **************************************************************** ok: [myhost1] TASK [command] ***************************************************************** changed: [myhost1] TASK [set_fact] **************************************************************** ok: [myhost1] PLAY *************************************************************************** TASK [setup] *******************************************************************ok: [myhost2] TASK [command] ***************************************************************** fatal: [myhost2]: FAILED! => {"changed": true, "cmd": "docker swarm join --token [u'SWMTKN-1-0lanrq32u7f1v47noxftd1ekpzgipo3noufg7ppox3aooqhmqh-3peerw7aalzg8ko13zrqh6hee'] myhost1:2377", "delta": "0:00:00.036979", "end": "2016-08-07 20:20:16.500147", "failed": true, "rc": 1, "start": "2016-08-07 20:20:16.463168", "stderr": "Error response from daemon: invalid join token", "stdout": "", "stdout_lines": [], "warnings": []} PLAY RECAP ********************************************************************* myhost1 : ok=6 changed=3 unreachable=0 failed=0 myhost2 : ok=1 changed=0 unreachable=0 failed=1 FATAL: command execution failed hudson.AbortException: Ansible playbook execution failed at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:218) at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:192) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) ERROR: Ansible playbook execution failed Notifying upstream projects of job completion Finished: FAILURE
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/43c19f78-9572-4af2-8e52-784878805bcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Steve