Last active
December 9, 2016 18:18
-
-
Save technovangelist/6e2f504818d33235bee2311845df586a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - hosts: manager | |
| become: yes | |
| tasks: | |
| - name: Initialize Docker Swarm | |
| shell: docker swarm init --advertise-addr {{ ansible_eth1.ipv4.address}} | |
| - hosts: manager | |
| become: no | |
| tasks: | |
| - name: Capture Docker Swarm Join Command | |
| shell: docker swarm join-token worker -q | |
| register: swarmtoken | |
| - local_action: copy content="{{ swarmtoken.stdout }}" dest=./swarmtoken force=yes | |
| - hosts: group-workers | |
| become: yes | |
| tasks: | |
| - name: Start Swarm Nodes | |
| shell: docker swarm join --token={{ lookup('file', './swarmtoken') }} {{ hostvars['manager'].ansible_eth1.ipv4.address }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment