Update cluster config var to include public+private addresses
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -37,12 +37,12 @@
 | 
			
		||||
      vars:
 | 
			
		||||
        _cluster_node_ips: []
 | 
			
		||||
      ansible.builtin.set_fact:
 | 
			
		||||
        _cluster_node_ips: "{{ _cluster_node_ips + [hostvars[item].skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix')] }}"
 | 
			
		||||
        _cluster_node_ips: "{{ _cluster_node_ips + [hostvars[item].skylab_cluster.address.access | ansible.netcommon.ipaddr('host/prefix')] }}"
 | 
			
		||||
      loop: "{{ groups.cluster }}"
 | 
			
		||||
 | 
			
		||||
    - name: Remove alternative node IPs
 | 
			
		||||
      become: true
 | 
			
		||||
      when: item in _cluster_node_ips and item != (skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix'))
 | 
			
		||||
      when: item in _cluster_node_ips and item != (skylab_cluster.address.access | ansible.netcommon.ipaddr('host/prefix'))
 | 
			
		||||
      ansible.builtin.command:
 | 
			
		||||
        cmd: ip address delete {{ item | ansible.netcommon.ipaddr('host/prefix') }} dev {{ skylab_cluster.interface.access }}
 | 
			
		||||
      changed_when: true
 | 
			
		||||
@@ -50,7 +50,7 @@
 | 
			
		||||
 | 
			
		||||
    - name: Add node IP
 | 
			
		||||
      become: true
 | 
			
		||||
      when: skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix') not in _node_addresses
 | 
			
		||||
      when: skylab_cluster.address.access | ansible.netcommon.ipaddr('host/prefix') not in _node_addresses
 | 
			
		||||
      ansible.builtin.command:
 | 
			
		||||
        cmd: ip address add {{ skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix') }} dev {{ skylab_cluster.interface.access }}
 | 
			
		||||
        cmd: ip address add {{ skylab_cluster.address.access | ansible.netcommon.ipaddr('host/prefix') }} dev {{ skylab_cluster.interface.access }}
 | 
			
		||||
      changed_when: true
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user