ops/playbooks/initialServer/workers.yml

30 lines
749 B
YAML

---
- name: configure worker for docker swarm
become: yes
hosts: workers
# add var file
vars_files:
- "var/swarm.yml"
- "var/hosts.yml"
tasks:
- name: join node in swarm as worker
shell: docker swarm join --token {{ worker_token }} {{ item.local }}:2377
with_items:
- "{{ supermaster }}"
ignore_errors: yes
- name: create /volume
shell: mkdir -p /volume
- name: mount nfs
shell: mount {{ item.local }}:/volume /volume
with_items:
- "{{ masters }}"
- name: mount nfs /etc/fstab
shell: echo "{{ item.local }}:/volume /volume nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" >> /etc/fstab
with_items:
- "{{ masters }}"