Skip to content

Commit ffa7b99

Browse files
committed
[multiple] Integrate radvd role in libvirt_manager
Integration radvd role with libvirt_manager: - Added cifmw_libvirt_manager_radvd_networks parameter - Automatically configures radvd when networks are created - Documented in libvirt_manager README with usage examples Depends-On: openstack-k8s-operators#3483 Assisted-By: Claude Code/claude-4.5-sonnet Signed-off-by: Harald Jensås <[email protected]>
1 parent 0b0a801 commit ffa7b99

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

roles/libvirt_manager/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Used for checking if:
4545
* `cifmw_libvirt_manager_default_gw_nets`: (List[String]) List of networks used as default gateway. If not set, defaults to the `cifmw_libvirt_manager_pub_net`. Read bellow for more information about that parameter.
4646
* `cifmw_libvirt_manager_vm_users`: (List[Dict]) Used to override the default list of users enabled in the vm. For its format, refers to cloud-init [documentation](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) about `users`. Defaults to `[]`.
4747
* `cifmw_libvirt_manager_extra_network_configuration`: (Dict) Extra network configuration in nmstate format for the hypervisor. This configuration is applied after creating the libvirt networks, so it can be used to create VLAN interfaces on the libvirt bridges. In addition to nmstate, it also supports a `cifmw_firewall_zone` hint in nmstate interfaces. Defaults to: `{}`.
48+
* `cifmw_libvirt_manager_radvd_networks`: (List[Dict]) List of networks to configure with radvd for IPv6 router advertisements. When defined, the `radvd` role will be included after network creation. Each network definition follows the format documented in the `radvd` role. Defaults to `[]`.
4849

4950
### `cifmw_libvirt_manager_default_gw_nets` parameter usage
5051

@@ -245,3 +246,20 @@ layout used by the role.
245246
name: libvirt_manager
246247
tasks_from: attack_interface.yml
247248
```
249+
250+
## IPv6 Router Advertisements with radvd
251+
252+
The libvirt_manager role can automatically configure IPv6 router advertisements using the `radvd` role. This is useful for providing SLAAC and/or DHCPv6 configuration to VMs on IPv6-enabled networks.
253+
254+
To enable radvd, define `cifmw_libvirt_manager_radvd_networks` with a list of network configurations:
255+
256+
```yaml
257+
cifmw_libvirt_manager_radvd_networks:
258+
- name: cifmw-testnet1
259+
adv_managed_flag: true
260+
adv_other_config_flag: true
261+
prefixes:
262+
- network: "2001:db8:1::/64"
263+
```
264+
265+
For complete documentation on available parameters and configuration options, refer to the [radvd role documentation](../radvd/README.md).

roles/libvirt_manager/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ cifmw_libvirt_manager_attach_dummy_interface_on_bridges: true
8888
cifmw_libvirt_manager_extra_network_configuration: {}
8989

9090
cifmw_libvirt_manager_vm_users: []
91+
cifmw_libvirt_manager_radvd_networks: []

roles/libvirt_manager/tasks/clean_layout.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,8 @@
348348
ansible.builtin.import_role:
349349
name: dnsmasq
350350
tasks_from: cleanup.yml
351+
352+
- name: Clean radvd
353+
ansible.builtin.import_role:
354+
name: radvd
355+
tasks_from: cleanup.yml

roles/libvirt_manager/tasks/create_networks.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,14 @@
229229
loop_control:
230230
label: "{{ item.name }}"
231231

232+
- name: Deploy radvd for IPv6 router advertisements
233+
when:
234+
- cifmw_libvirt_manager_radvd_networks | length > 0
235+
vars:
236+
cifmw_radvd_networks: "{{ cifmw_libvirt_manager_radvd_networks }}"
237+
ansible.builtin.include_role:
238+
name: radvd
239+
232240
- name: Ensure network is in correct zone
233241
become: true
234242
notify: Restart firewalld

roles/radvd/tasks/cleanup.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Gather package facts
18+
ansible.builtin.package_facts:
19+
manager: auto
20+
1721
- name: Stop and disable radvd service
1822
become: true
23+
when:
24+
- "'radvd' in ansible_facts.packages"
1925
ansible.builtin.systemd:
2026
name: radvd.service
2127
enabled: false

0 commit comments

Comments
 (0)