mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2026-08-09 07:23:19 +02:00
fix(molecule): stabilize host-only peer identity
- restore host-only routing required by outside verification - assign deterministic adapter MACs to the five default guests - pin disposable full-mesh neighbor entries from live Ansible facts
This commit is contained in:
committed by
Techno Tim
parent
4990157d35
commit
fb9a0bebd1
@@ -14,12 +14,13 @@ platforms:
|
|||||||
groups:
|
groups:
|
||||||
- k3s_cluster
|
- k3s_cluster
|
||||||
- master
|
- master
|
||||||
|
# Keep adapter 2 stable across linked-clone rebuilds so stale host-only
|
||||||
|
# neighbor state still identifies the current scenario guest.
|
||||||
|
provider_raw_config_args:
|
||||||
|
- "customize ['modifyvm', :id, '--mac-address2', '080027A13038']"
|
||||||
interfaces:
|
interfaces:
|
||||||
- network_name: private_network
|
- network_name: private_network
|
||||||
ip: 192.168.30.38
|
ip: 192.168.30.38
|
||||||
# Keep this cluster off the persistent vboxnet0 host-only switch. The
|
|
||||||
# NAT adapter remains available for SSH and Internet access.
|
|
||||||
virtualbox__intnet: k3s-ansible-default
|
|
||||||
config_options:
|
config_options:
|
||||||
# We currently can not use public-key based authentication on Ubuntu 22.04,
|
# We currently can not use public-key based authentication on Ubuntu 22.04,
|
||||||
# see: https://github.com/chef/bento/issues/1405
|
# see: https://github.com/chef/bento/issues/1405
|
||||||
@@ -33,10 +34,11 @@ platforms:
|
|||||||
groups:
|
groups:
|
||||||
- k3s_cluster
|
- k3s_cluster
|
||||||
- master
|
- master
|
||||||
|
provider_raw_config_args:
|
||||||
|
- "customize ['modifyvm', :id, '--mac-address2', '080027A13039']"
|
||||||
interfaces:
|
interfaces:
|
||||||
- network_name: private_network
|
- network_name: private_network
|
||||||
ip: 192.168.30.39
|
ip: 192.168.30.39
|
||||||
virtualbox__intnet: k3s-ansible-default
|
|
||||||
|
|
||||||
- name: control3
|
- name: control3
|
||||||
box: generic/rocky9
|
box: generic/rocky9
|
||||||
@@ -45,10 +47,11 @@ platforms:
|
|||||||
groups:
|
groups:
|
||||||
- k3s_cluster
|
- k3s_cluster
|
||||||
- master
|
- master
|
||||||
|
provider_raw_config_args:
|
||||||
|
- "customize ['modifyvm', :id, '--mac-address2', '080027A13040']"
|
||||||
interfaces:
|
interfaces:
|
||||||
- network_name: private_network
|
- network_name: private_network
|
||||||
ip: 192.168.30.40
|
ip: 192.168.30.40
|
||||||
virtualbox__intnet: k3s-ansible-default
|
|
||||||
|
|
||||||
- name: node1
|
- name: node1
|
||||||
box: generic/ubuntu2204
|
box: generic/ubuntu2204
|
||||||
@@ -57,10 +60,11 @@ platforms:
|
|||||||
groups:
|
groups:
|
||||||
- k3s_cluster
|
- k3s_cluster
|
||||||
- node
|
- node
|
||||||
|
provider_raw_config_args:
|
||||||
|
- "customize ['modifyvm', :id, '--mac-address2', '080027A13041']"
|
||||||
interfaces:
|
interfaces:
|
||||||
- network_name: private_network
|
- network_name: private_network
|
||||||
ip: 192.168.30.41
|
ip: 192.168.30.41
|
||||||
virtualbox__intnet: k3s-ansible-default
|
|
||||||
config_options:
|
config_options:
|
||||||
# We currently can not use public-key based authentication on Ubuntu 22.04,
|
# We currently can not use public-key based authentication on Ubuntu 22.04,
|
||||||
# see: https://github.com/chef/bento/issues/1405
|
# see: https://github.com/chef/bento/issues/1405
|
||||||
@@ -74,10 +78,11 @@ platforms:
|
|||||||
groups:
|
groups:
|
||||||
- k3s_cluster
|
- k3s_cluster
|
||||||
- node
|
- node
|
||||||
|
provider_raw_config_args:
|
||||||
|
- "customize ['modifyvm', :id, '--mac-address2', '080027A13042']"
|
||||||
interfaces:
|
interfaces:
|
||||||
- network_name: private_network
|
- network_name: private_network
|
||||||
ip: 192.168.30.42
|
ip: 192.168.30.42
|
||||||
virtualbox__intnet: k3s-ansible-default
|
|
||||||
|
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
|||||||
@@ -49,19 +49,34 @@
|
|||||||
The Vagrant private interface {{ flannel_iface }} does not have an
|
The Vagrant private interface {{ flannel_iface }} does not have an
|
||||||
IPv4 address on {{ inventory_hostname }}.
|
IPv4 address on {{ inventory_hostname }}.
|
||||||
|
|
||||||
- name: Clear cached primary neighbor entry
|
- name: Pin disposable cluster peer neighbor entries
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv:
|
argv:
|
||||||
- ip
|
- ip
|
||||||
- neigh
|
- neigh
|
||||||
- flush
|
- replace
|
||||||
- to
|
- "{{ peer_cluster_ip }}"
|
||||||
- "{{ primary_cluster_ip }}"
|
- lladdr
|
||||||
|
- "{{ peer_cluster_mac }}"
|
||||||
|
- nud
|
||||||
|
- permanent
|
||||||
- dev
|
- dev
|
||||||
- "{{ cluster_interface }}"
|
- "{{ cluster_interface }}"
|
||||||
become: true
|
become: true
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: inventory_hostname != primary_master
|
loop: "{{ groups['k3s_cluster'] }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ inventory_hostname }} -> {{ item }}"
|
||||||
|
vars:
|
||||||
|
peer_cluster_interface: >-
|
||||||
|
{{ hostvars[item].cilium_iface
|
||||||
|
| default(hostvars[item].calico_iface
|
||||||
|
| default(hostvars[item].flannel_iface)) }}
|
||||||
|
peer_cluster_ip: >-
|
||||||
|
{{ hostvars[item].k3s_node_ip | split(',') | first }}
|
||||||
|
peer_cluster_mac: >-
|
||||||
|
{{ hostvars[item].ansible_facts[peer_cluster_interface].macaddress }}
|
||||||
|
when: item != inventory_hostname
|
||||||
|
|
||||||
- name: Verify guest-to-guest cluster network reachability
|
- name: Verify guest-to-guest cluster network reachability
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
|
|||||||
Reference in New Issue
Block a user