Merge branch 'main' of ssh://gitea.adalal.net:2222/adalal/ansible-config

This commit is contained in:
Aritra Dalal
2026-05-05 16:34:30 +01:00

View File

@@ -0,0 +1,44 @@
---
- name: "Bootstrap Docker Swarm on IPv6"
hosts: controlnode
become: true
vars:
# Explicitly defining the IPs based on network map
mgmt_ip: "fda7:740:3e00:c721:231c:8e23:d51d:1ccb"
data_ip: "fda7:740:3e00:403e:3a6e:fde8:ea84:d4b5"
tasks:
- name: Ensure docker is installed (standard repo)
apt:
name:
- docker.io
- python3-docker
state: present
- name: Configure Docker Daemon for IPv6
copy:
dest: /etc/docker/daemon.json
content: |
{
"ipv6": true,
"fixed-cidr-v6": "fda7:740:3e00:docc::/64",
"ip6tables": true,
"experimental": true
}
notify: Restart Docker
- name: Flush handler to apply Docker config immediately
meta: flush_handlers
- name: Initialise or update Docker Swarm Manager
community.docker.docker_swarm:
state: present
advertise_addr: "[{{ mgmt_ip }}]"
data_path_addr: "[{{ data_ip }}]"
register: swarm_result
handlers:
- name: Restart Docker
ansible.builtin.systemd:
name: docker
state: restarted