Update cluster interface config to specify internal and external
This commit is contained in:
parent
28af9314ef
commit
8c69b7af95
@ -32,8 +32,8 @@ en1:
|
||||
skylab_targets: [cluster, datastore]
|
||||
skylab_roles:
|
||||
- server
|
||||
- docker-swarm
|
||||
- datastore
|
||||
- swarm
|
||||
skylab_direct_peers:
|
||||
- hostname: pegasus.local jupiter.svr.local
|
||||
address: 192.168.42.10
|
||||
@ -49,7 +49,9 @@ en1:
|
||||
skylab_description: Arbiter Node
|
||||
skylab_cluster:
|
||||
address: 10.42.101.10/24
|
||||
interface: bond0
|
||||
interface:
|
||||
access: bond0
|
||||
internal: bond0.99
|
||||
skylab_networking:
|
||||
eno1:
|
||||
bond: bond0
|
||||
@ -78,7 +80,9 @@ en1:
|
||||
skylab_description: Operational Node
|
||||
skylab_cluster:
|
||||
address: 10.42.101.11/24
|
||||
interface: bond0
|
||||
interface:
|
||||
access: bond0
|
||||
internal: bond0.99
|
||||
skylab_networking:
|
||||
eno1:
|
||||
bond: bond0
|
||||
@ -107,7 +111,9 @@ en1:
|
||||
skylab_description: Operational Node
|
||||
skylab_cluster:
|
||||
address: 10.42.101.12/24
|
||||
interface: bond0
|
||||
interface:
|
||||
access: bond0
|
||||
internal: bond0.99
|
||||
skylab_datastore_device: sdb
|
||||
skylab_networking:
|
||||
eno1:
|
||||
|
@ -43,10 +43,10 @@
|
||||
- name: Set common fact for node addresses
|
||||
vars:
|
||||
_node_addresses:
|
||||
- "{{ lookup('vars', 'ansible_' + skylab_cluster.interface).ipv4.address }}"
|
||||
- "{{ lookup('vars', 'ansible_' + skylab_cluster.interface.access).ipv4.address }}"
|
||||
ansible.builtin.set_fact:
|
||||
_node_addresses: "{{ _node_addresses + [item.address] }}"
|
||||
loop: "{{ lookup('vars', 'ansible_' + skylab_cluster.interface).ipv4_secondaries }}"
|
||||
loop: "{{ lookup('vars', 'ansible_' + skylab_cluster.interface.access).ipv4_secondaries }}"
|
||||
loop_control:
|
||||
label: "{{ item.address }}"
|
||||
|
||||
@ -117,7 +117,7 @@
|
||||
become: true
|
||||
when: skylab_cluster.address | 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 }}
|
||||
cmd: ip address delete {{ skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix') }} dev {{ skylab_cluster.interface.access }}
|
||||
changed_when: true
|
||||
|
||||
- name: Assign address to alt node
|
||||
@ -125,5 +125,5 @@
|
||||
become: true
|
||||
when: skylab_cluster.address | 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 }}
|
||||
cmd: ip address add {{ skylab_cluster.address | ansible.netcommon.ipaddr('host/prefix') }} dev {{ hostvars[_target_alt].skylab_cluster.interface.access }}
|
||||
changed_when: true
|
||||
|
Reference in New Issue
Block a user