Update node update config to use node id rather than magic name

This commit is contained in:
Ethan Paul 2021-11-11 00:07:58 -05:00
parent 4275a0bc23
commit 776e35f1a3
No known key found for this signature in database
GPG Key ID: 6A337337DF6B5B1A

View File

@ -30,6 +30,12 @@
remote_addrs: "{{ _docker_swarm_manager_addresses }}" remote_addrs: "{{ _docker_swarm_manager_addresses }}"
join_token: "{{ _docker_swarm_join_token.stdout.strip() }}" 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 # 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 # until the configuration is complete. The node-up playbook will be responsible for updating
# the node to make it available in the cluster again # the node to make it available in the cluster again
@ -38,4 +44,4 @@
ansible_python_interpreter: "{{ skylab_ansible_venv }}/bin/python" ansible_python_interpreter: "{{ skylab_ansible_venv }}/bin/python"
community.docker.docker_node: community.docker.docker_node:
availability: drain availability: drain
hostname: "{{ skylab_hostname }}" hostname: "{{ _docker_node_id_raw.stdout.strip() }}"