forked from ccchb/ansible
Use ansible ipath to derive /31 and /127 from the guest index
This commit is contained in:
parent
82df9558cd
commit
05ec7f2022
1 changed files with 29 additions and 0 deletions
29
roles/bhyve-network/tasks/main.yml
Normal file
29
roles/bhyve-network/tasks/main.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
- name: Describe guest interface
|
||||||
|
sysrc:
|
||||||
|
name: 'ifconfig_vmnet{{ item.index }}_descr'
|
||||||
|
value: 'VM {{ item.name }}'
|
||||||
|
loop_control:
|
||||||
|
label: '{{ item.name }} : vmnet{{ item.index }}'
|
||||||
|
with_items: '{{ bhyve_guests }}'
|
||||||
|
|
||||||
|
- name: Set host IPv4 addresses
|
||||||
|
sysrc:
|
||||||
|
name: 'ifconfig_vmnet{{ item.index }}'
|
||||||
|
value: 'inet {{ bhyve_ipv4 | ipmath(2 * item.index)}}/31'
|
||||||
|
with_items: '{{ bhyve_guests }}'
|
||||||
|
|
||||||
|
- name: Set host IPv6 addresses
|
||||||
|
sysrc:
|
||||||
|
name: 'ifconfig_vmnet{{ item.index }}_ipv6'
|
||||||
|
value: 'inet6 {{ bhyve_ipv6 | ipmath(2 * item.index)}}/127'
|
||||||
|
with_items: '{{ bhyve_guests }}'
|
||||||
|
|
||||||
|
- name: Add guest interfaces
|
||||||
|
sysrc:
|
||||||
|
name: cloned_interfaces
|
||||||
|
state: append
|
||||||
|
value: 'vmnet{{ item.index }}'
|
||||||
|
loop_control:
|
||||||
|
label: '{{ item.name }} : vmnet{{ item.index }}'
|
||||||
|
with_items: '{{ bhyve_guests }}'
|
Loading…
Reference in a new issue