summaryrefslogtreecommitdiff
path: root/playbooks/deploy-swarm-cluster.yml
blob: 22dcdb7e33d95cd0d7a81c5b28327592c574c66e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---

- name: Configure Docker Swarm Firewall Rules
  hosts: swarm
  become: true
  tasks:
    - name: Enable Local Swarm Communications
      loop: "{{ rfc1918_cgnat_networks }}"
      community.general.ufw:
        rule: allow
        port: "2377"
        from: "{{ item }}"
        state: enabled

    - name: Enable Local Swarm Communications
      loop: "{{ rfc1918_cgnat_networks }}"
      community.general.ufw:
        rule: allow
        port: "9001"
        from: "{{ item }}"
        state: enabled

- name: Setup swarm on init node
  hosts: swarm[0]
  become: true
  roles:
    - swarm-init

- name: Join non-init nodes
  hosts: swarm:!swarm[0]
  become: true
  roles:
    - swarm-join