summaryrefslogtreecommitdiff
path: root/playbooks/roles/swarm_cluster/tasks/main.yml
blob: b3173d59de95fdfbba3686d97f9ad7aa634ae495 (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
---

- name: Enable Local Swarm Communications
  community.general.ufw:
    rule: allow
    from: "{{ swarm_network }}"
    state: enabled

- name: Set swarm initializer variable
  ansible.builtin.set_fact:
    swarm_initializer_host: "{{ groups['swarm_cluster'][0] }}"

- name: Initialize the swarm cluster on the first node
  when: ansible_hostname == swarm_initializer_host
  ansible.builtin.import_tasks: swarm_init/tasks/main.yml

- name: Join the swarm cluster on all other nodes
  when: ansible_hostname != swarm_initializer_host
  ansible.builtin.import_tasks: swarm_join/tasks/main.yml

- name: Login to OCI
  when: not homelab_build
  ansible.builtin.command: "docker login {{ oci_domain }} --username {{ oci_username }} --password {{ oci_password }}"