one-deploy
one-deploy copied to clipboard
Outdated examples in 'network' role
Description
The following two examples seem to be outdated, both with Ansible and OpenNebula:
- https://github.com/OpenNebula/one-deploy/blob/f70dc3a1d29a28d26c472984370970c67e0f77bc/roles/network/frontend/README.md?plain=1#L24
- https://github.com/OpenNebula/one-deploy/blob/f70dc3a1d29a28d26c472984370970c67e0f77bc/roles/network/node/README.md?plain=1#L23
I found two problems with them:
- The example is not a valid playbook: hosts and roles cannot be added at the same time
- The given VNET templates are not picked up by the playbook because they have a wrong structure
Fix proposal
Rather give an inventory example inventory-with-network.yaml:
[...]
frontend:
hosts:
fe: { ansible_host: 10.0.0.1 }
vars:
vn:
bridge:
managed: true
template:
VN_MAD: bridge
AR:
TYPE: IP4
IP: 10.11.12.200
SIZE: 48
NETWORK_ADDRESS: 10.11.12.0
NETWORK_MASK: 255.255.255.0
GATEWAY: 10.11.12.1
DNS: 1.1.1.1
vxlan:
managed: true
template:
VN_MAD: vxlan
PHYDEV: ens6
BRIDGE: br1
VLAN_ID: 86
FILTER_IP_SPOOFING: 'NO'
FILTER_MAC_SPOOFING: 'YES'
GUEST_MTU: 1450
AR:
TYPE: IP4
IP: 192.168.150.200
SIZE: 48
NETWORK_ADDRESS: 192.168.150.0
NETWORK_MASK: 255.255.255.0
node:
hosts:
host01: { ansible_host: 10.0.0.2 }
vars:
vn:
vxlan:
# Define a VNET of type vxlan and move IP4/6 settings from ens6 to br1.
managed: true
template:
VN_MAD: vxlan
PHYDEV: ens6
BRIDGE: br1
VLAN_ID: 86
FILTER_IP_SPOOFING: 'NO'
FILTER_MAC_SPOOFING: 'YES'
GUEST_MTU: 1450
AR:
TYPE: IP4
IP: 192.168.150.200
SIZE: 48
NETWORK_ADDRESS: 192.168.150.0
NETWORK_MASK: 255.255.255.0
And its invokation with tags, as it is shown in the one-deploy Wikik:
cd one-deploy
hatch shell
cd my-dir
ansible-playbook -i inventory-with-network.yaml -v opennebula.deploy.main -t network
Hi @balazsbme 🤗
The example is not a valid playbook: hosts and roles cannot be added at the same time
This looks to me like a false statement, basic construction like below is actually a valid playbook:
---
- hosts: 127.0.0.1
connection: local
vars:
asd: 123
roles:
- opennebula.deploy.helper.facts
post_tasks:
- debug: var=asd
The given VNET templates are not picked up by the playbook because they have a wrong structure
Yes that is true, the structure is incorrect because this is an example from intial implementation of network roles, later it was simplified, but nobody ever corrected or reported it (before this issue).
The example should look more like:
vn:
# Define a VNET of type bridge using predefined bridge br0.
service:
managed: true
template:
VN_MAD: bridge
BRIDGE: br0
AR:
TYPE: IP4
IP: 10.11.12.200
SIZE: 48
NETWORK_ADDRESS: 10.11.12.0
NETWORK_MASK: 255.255.255.0
GATEWAY: 10.11.12.1
DNS: 1.1.1.1
# Define a VNET of type vxlan and move IP4/6 settings from bond0 to br1.
vm:
managed: true
template:
VN_MAD: vxlan
PHYDEV: bond0
BRIDGE: br1
VLAN_ID: 86
FILTER_IP_SPOOFING: 'NO'
FILTER_MAC_SPOOFING: 'YES'
GUEST_MTU: 1450
AR:
TYPE: IP4
IP: 192.168.150.200
SIZE: 48
NETWORK_ADDRESS: 192.168.150.0
NETWORK_MASK: 255.255.255.0
Rather give an inventory example inventory-with-network.yaml:
Yes role readme files are not there to replace full inventory examples.