From 776e35f1a3f42ba5342c652ac75a3dbf21427f58 Mon Sep 17 00:00:00 2001 From: Ethan Paul Date: Thu, 11 Nov 2021 00:07:58 -0500 Subject: [PATCH] Update node update config to use node id rather than magic name --- roles/swarm/tasks/join.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/swarm/tasks/join.yaml b/roles/swarm/tasks/join.yaml index 8a779a1..f4cfa8c 100644 --- a/roles/swarm/tasks/join.yaml +++ b/roles/swarm/tasks/join.yaml @@ -30,6 +30,12 @@ remote_addrs: "{{ _docker_swarm_manager_addresses }}" join_token: "{{ _docker_swarm_join_token.stdout.strip() }}" +- name: Fetch node swarm ID + ansible.builtin.command: + cmd: !unsafe docker info --format '{{ .Swarm.NodeID}}' + changed_when: false + register: _docker_node_id_raw + # For newly added nodes we don't want to have services be automatically scheduled on them # until the configuration is complete. The node-up playbook will be responsible for updating # the node to make it available in the cluster again @@ -38,4 +44,4 @@ ansible_python_interpreter: "{{ skylab_ansible_venv }}/bin/python" community.docker.docker_node: availability: drain - hostname: "{{ skylab_hostname }}" + hostname: "{{ _docker_node_id_raw.stdout.strip() }}"