Skip to content

Instantly share code, notes, and snippets.

@runcom
Last active July 23, 2016 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runcom/af602acfc6510f539f05fb5f21c95a1e to your computer and use it in GitHub Desktop.
Save runcom/af602acfc6510f539f05fb5f21c95a1e to your computer and use it in GitHub Desktop.
SWARM_SECRET=91pqsf3o0nax7mrfoiy5zy1d9 \
SWARM_CA_HASH=sha256:6b802f9d75708d71ea07c95c16ff5c26eaea01899010b6f401f63185ddacd375 \
SWARM_MASTER=192.168.122.57 \
ansible-playbook setup_worker.yml -i workers --ask-pass
---
- hosts: workers
tasks:
- redhat_subscription: state=present username=youruser@redhat.com password=secretpassword autosubscribe=true
- yum: name=* state=latest
- shell: curl -fsSL https://test.docker.com/ | sh
- shell: sed -i 's/ExecStart=\/usr\/bin\/dockerd -H fd:\/\//ExecStart=\/usr\/bin\/dockerd -H fd:\/\/ --label test=test/g' /usr/lib/systemd/system/docker.service
- service: name=docker state=started
- shell: docker swarm join --secret {{ lookup('env','SWARM_SECRET') }} --ca-hash {{ lookup('env','SWARM_CA_HASH') }} {{ lookup('env','SWARM_MASTER') }}
[all:vars]
ansible_connection=ssh
ansible_ssh_user=root
ansible_ssh_pass=password
[workers]
192.168.122.164
192.168.122.95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment