Update cluster config var to include public+private addresses

This commit is contained in:
2021-11-13 19:24:59 -05:00
parent 20450332d4
commit f178a7bf78
5 changed files with 33 additions and 27 deletions

View File

@@ -59,7 +59,7 @@
when: inventory_hostname != _target_node
ansible.builtin.assert:
that:
- skylab_cluster.address | ansible.netcommon.ipaddr('address') in _node_addresses
- skylab_cluster.address.access | ansible.netcommon.ipaddr('address') in _node_addresses
- _docker_node_availability | lower == 'active'
fail_msg: >-
ERROR: Node '{{ inventory_hostname }}' is already marked as unavailable. All cluster
@@ -115,15 +115,15 @@
- name: Delete address from node
become: true
when: skylab_cluster.address | ansible.netcommon.ipaddr('address') in _node_addresses
when: skylab_cluster.address.access | ansible.netcommon.ipaddr('address') in _node_addresses
ansible.builtin.command:
cmd: ip address delete {{ skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix') }} dev {{ skylab_cluster.interface.access }}
cmd: ip address delete {{ skylab_cluster.address.access | ansible.netcommon.ipaddr('host/prefix') }} dev {{ skylab_cluster.interface.access }}
changed_when: true
- name: Assign address to alt node
delegate_to: "{{ _target_alt }}"
become: true
when: skylab_cluster.address | ansible.netcommon.ipaddr('address') not in hostvars[_target_alt]._node_addresses
when: skylab_cluster.address.access | ansible.netcommon.ipaddr('address') not in hostvars[_target_alt]._node_addresses
ansible.builtin.command:
cmd: ip address add {{ skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix') }} dev {{ hostvars[_target_alt].skylab_cluster.interface.access }}
cmd: ip address add {{ skylab_cluster.address.access | ansible.netcommon.ipaddr('host/prefix') }} dev {{ hostvars[_target_alt].skylab_cluster.interface.access }}
changed_when: true