|
|
|
@ -234,32 +234,75 @@ tenant_gw: "172.100.0.254"
|
|
|
|
|
|
|
|
|
|
#Team vars
|
|
|
|
|
nmcli_team:
|
|
|
|
|
- {conn_name: 'tenant', ip4: "{{tenant_ip}}", gw4: "{{tenant_gw}}"}
|
|
|
|
|
- {conn_name: 'external', ip4: "{{external_ip}}", gw4: "{{external_gw}}"}
|
|
|
|
|
- {conn_name: 'storage', ip4: "{{storage_ip}}", gw4: "{{storage_gw}}"}
|
|
|
|
|
- conn_name: tenant
|
|
|
|
|
ip4: '{{ tenant_ip }}'
|
|
|
|
|
gw4: '{{ tenant_gw }}'
|
|
|
|
|
- conn_name: external
|
|
|
|
|
ip4: '{{ external_ip }}'
|
|
|
|
|
gw4: '{{ external_gw }}'
|
|
|
|
|
- conn_name: storage
|
|
|
|
|
ip4: '{{ storage_ip }}'
|
|
|
|
|
gw4: '{{ storage_gw }}'
|
|
|
|
|
nmcli_team_slave:
|
|
|
|
|
- {conn_name: 'em1', ifname: 'em1', master: 'tenant'}
|
|
|
|
|
- {conn_name: 'em2', ifname: 'em2', master: 'tenant'}
|
|
|
|
|
- {conn_name: 'p2p1', ifname: 'p2p1', master: 'storage'}
|
|
|
|
|
- {conn_name: 'p2p2', ifname: 'p2p2', master: 'external'}
|
|
|
|
|
- conn_name: em1
|
|
|
|
|
ifname: em1
|
|
|
|
|
master: tenant
|
|
|
|
|
- conn_name: em2
|
|
|
|
|
ifname: em2
|
|
|
|
|
master: tenant
|
|
|
|
|
- conn_name: p2p1
|
|
|
|
|
ifname: p2p1
|
|
|
|
|
master: storage
|
|
|
|
|
- conn_name: p2p2
|
|
|
|
|
ifname: p2p2
|
|
|
|
|
master: external
|
|
|
|
|
|
|
|
|
|
#bond vars
|
|
|
|
|
nmcli_bond:
|
|
|
|
|
- {conn_name: 'tenant', ip4: "{{tenant_ip}}", gw4: '', mode: 'balance-rr'}
|
|
|
|
|
- {conn_name: 'external', ip4: "{{external_ip}}", gw4: '', mode: 'balance-rr'}
|
|
|
|
|
- {conn_name: 'storage', ip4: "{{storage_ip}}", gw4: "{{storage_gw}}", mode: 'balance-rr'}
|
|
|
|
|
- conn_name: tenant
|
|
|
|
|
ip4: '{{ tenant_ip }}'
|
|
|
|
|
gw4: ''
|
|
|
|
|
mode: balance-rr
|
|
|
|
|
- conn_name: external
|
|
|
|
|
ip4: '{{ external_ip }}'
|
|
|
|
|
gw4: ''
|
|
|
|
|
mode: balance-rr
|
|
|
|
|
- conn_name: storage
|
|
|
|
|
ip4: '{{ storage_ip }}'
|
|
|
|
|
gw4: '{{ storage_gw }}'
|
|
|
|
|
mode: balance-rr
|
|
|
|
|
nmcli_bond_slave:
|
|
|
|
|
- {conn_name: 'em1', ifname: 'em1', master: 'tenant'}
|
|
|
|
|
- {conn_name: 'em2', ifname: 'em2', master: 'tenant'}
|
|
|
|
|
- {conn_name: 'p2p1', ifname: 'p2p1', master: 'storage'}
|
|
|
|
|
- {conn_name: 'p2p2', ifname: 'p2p2', master: 'external'}
|
|
|
|
|
- conn_name: em1
|
|
|
|
|
ifname: em1
|
|
|
|
|
master: tenant
|
|
|
|
|
- conn_name: em2
|
|
|
|
|
ifname: em2
|
|
|
|
|
master: tenant
|
|
|
|
|
- conn_name: p2p1
|
|
|
|
|
ifname: p2p1
|
|
|
|
|
master: storage
|
|
|
|
|
- conn_name: p2p2
|
|
|
|
|
ifname: p2p2
|
|
|
|
|
master: external
|
|
|
|
|
|
|
|
|
|
#ethernet vars
|
|
|
|
|
nmcli_ethernet:
|
|
|
|
|
- {conn_name: 'em1', ifname: 'em1', ip4: "{{tenant_ip}}", gw4: "{{tenant_gw}}"}
|
|
|
|
|
- {conn_name: 'em2', ifname: 'em2', ip4: "{{tenant_ip1}}", gw4: "{{tenant_gw}}"}
|
|
|
|
|
- {conn_name: 'p2p1', ifname: 'p2p1', ip4: "{{storage_ip}}", gw4: "{{storage_gw}}"}
|
|
|
|
|
- {conn_name: 'p2p2', ifname: 'p2p2', ip4: "{{external_ip}}", gw4: "{{external_gw}}"}
|
|
|
|
|
- conn_name: em1
|
|
|
|
|
ifname: em1
|
|
|
|
|
ip4: '{{ tenant_ip }}'
|
|
|
|
|
gw4: '{{ tenant_gw }}'
|
|
|
|
|
- conn_name: em2
|
|
|
|
|
ifname: em2
|
|
|
|
|
ip4: '{{ tenant_ip1 }}'
|
|
|
|
|
gw4: '{{ tenant_gw }}'
|
|
|
|
|
- conn_name: p2p1
|
|
|
|
|
ifname: p2p1
|
|
|
|
|
ip4: '{{ storage_ip }}'
|
|
|
|
|
gw4: '{{ storage_gw }}'
|
|
|
|
|
- conn_name: p2p2
|
|
|
|
|
ifname: p2p2
|
|
|
|
|
ip4: '{{ external_ip }}'
|
|
|
|
|
gw4: '{{ external_gw }}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### host_vars
|
|
|
|
@ -280,42 +323,70 @@ tenant_ip: "192.168.200.21/23"
|
|
|
|
|
remote_user: root
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
|
|
- name: install needed network manager libs
|
|
|
|
|
yum: name={{ item }} state=installed
|
|
|
|
|
with_items:
|
|
|
|
|
- NetworkManager-glib
|
|
|
|
|
- libnm-qt-devel.x86_64
|
|
|
|
|
- nm-connection-editor.x86_64
|
|
|
|
|
- libsemanage-python
|
|
|
|
|
- policycoreutils-python
|
|
|
|
|
- name: install needed network manager libs
|
|
|
|
|
yum:
|
|
|
|
|
name: '{{ item }}'
|
|
|
|
|
state: installed
|
|
|
|
|
with_items:
|
|
|
|
|
- NetworkManager-glib
|
|
|
|
|
- libnm-qt-devel.x86_64
|
|
|
|
|
- nm-connection-editor.x86_64
|
|
|
|
|
- libsemanage-python
|
|
|
|
|
- policycoreutils-python
|
|
|
|
|
|
|
|
|
|
##### Working with all cloud nodes - Teaming
|
|
|
|
|
- name: try nmcli add team - conn_name only & ip4 gw4
|
|
|
|
|
nmcli: type=team conn_name={{item.conn_name}} ip4={{item.ip4}} gw4={{item.gw4}} state=present
|
|
|
|
|
nmcli:
|
|
|
|
|
type: team
|
|
|
|
|
conn_name: '{{ item.conn_name }}'
|
|
|
|
|
ip4: '{{ item.ip4 }}'
|
|
|
|
|
gw4: '{{ item.gw4 }}'
|
|
|
|
|
state: present
|
|
|
|
|
with_items:
|
|
|
|
|
- "{{nmcli_team}}"
|
|
|
|
|
- '{{ nmcli_team }}'
|
|
|
|
|
|
|
|
|
|
- name: try nmcli add teams-slave
|
|
|
|
|
nmcli: type=team-slave conn_name={{item.conn_name}} ifname={{item.ifname}} master={{item.master}} state=present
|
|
|
|
|
nmcli:
|
|
|
|
|
type: team-slave
|
|
|
|
|
conn_name: '{{ item.conn_name }}'
|
|
|
|
|
ifname: '{{ item.ifname }}'
|
|
|
|
|
master: '{{ item.master }}'
|
|
|
|
|
state: present
|
|
|
|
|
with_items:
|
|
|
|
|
- "{{nmcli_team_slave}}"
|
|
|
|
|
- '{{ nmcli_team_slave }}'
|
|
|
|
|
|
|
|
|
|
###### Working with all cloud nodes - Bonding
|
|
|
|
|
# - name: try nmcli add bond - conn_name only & ip4 gw4 mode
|
|
|
|
|
# nmcli: type=bond conn_name={{item.conn_name}} ip4={{item.ip4}} gw4={{item.gw4}} mode={{item.mode}} state=present
|
|
|
|
|
# nmcli:
|
|
|
|
|
# type: bond
|
|
|
|
|
# conn_name: '{{ item.conn_name }}'
|
|
|
|
|
# ip4: '{{ item.ip4 }}'
|
|
|
|
|
# gw4: '{{ item.gw4 }}'
|
|
|
|
|
# mode: '{{ item.mode }}'
|
|
|
|
|
# state: present
|
|
|
|
|
# with_items:
|
|
|
|
|
# - "{{nmcli_bond}}"
|
|
|
|
|
# - '{{ nmcli_bond }}'
|
|
|
|
|
#
|
|
|
|
|
# - name: try nmcli add bond-slave
|
|
|
|
|
# nmcli: type=bond-slave conn_name={{item.conn_name}} ifname={{item.ifname}} master={{item.master}} state=present
|
|
|
|
|
# nmcli:
|
|
|
|
|
# type: bond-slave
|
|
|
|
|
# conn_name: '{{ item.conn_name }}'
|
|
|
|
|
# ifname: '{{ item.ifname }}'
|
|
|
|
|
# master: '{{ item.master }}'
|
|
|
|
|
# state: present
|
|
|
|
|
# with_items:
|
|
|
|
|
# - "{{nmcli_bond_slave}}"
|
|
|
|
|
# - '{{ nmcli_bond_slave }}'
|
|
|
|
|
|
|
|
|
|
##### Working with all cloud nodes - Ethernet
|
|
|
|
|
# - name: nmcli add Ethernet - conn_name only & ip4 gw4
|
|
|
|
|
# nmcli: type=ethernet conn_name={{item.conn_name}} ip4={{item.ip4}} gw4={{item.gw4}} state=present
|
|
|
|
|
# nmcli:
|
|
|
|
|
# type: ethernet
|
|
|
|
|
# conn_name: '{{ item.conn_name }}'
|
|
|
|
|
# ip4: '{{ item.ip4 }}'
|
|
|
|
|
# gw4: '{{ item.gw4 }}'
|
|
|
|
|
# state: present
|
|
|
|
|
# with_items:
|
|
|
|
|
# - "{{nmcli_ethernet}}"
|
|
|
|
|
# - '{{ nmcli_ethernet }}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## playbook-del.yml example
|
|
|
|
@ -327,41 +398,77 @@ tenant_ip: "192.168.200.21/23"
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
|
|
- name: try nmcli del team - multiple
|
|
|
|
|
nmcli: conn_name={{item.conn_name}} state=absent
|
|
|
|
|
nmcli:
|
|
|
|
|
conn_name: '{{ item.conn_name }}'
|
|
|
|
|
state: absent
|
|
|
|
|
with_items:
|
|
|
|
|
- { conn_name: 'em1'}
|
|
|
|
|
- { conn_name: 'em2'}
|
|
|
|
|
- { conn_name: 'p1p1'}
|
|
|
|
|
- { conn_name: 'p1p2'}
|
|
|
|
|
- { conn_name: 'p2p1'}
|
|
|
|
|
- { conn_name: 'p2p2'}
|
|
|
|
|
- { conn_name: 'tenant'}
|
|
|
|
|
- { conn_name: 'storage'}
|
|
|
|
|
- { conn_name: 'external'}
|
|
|
|
|
- { conn_name: 'team-em1'}
|
|
|
|
|
- { conn_name: 'team-em2'}
|
|
|
|
|
- { conn_name: 'team-p1p1'}
|
|
|
|
|
- { conn_name: 'team-p1p2'}
|
|
|
|
|
- { conn_name: 'team-p2p1'}
|
|
|
|
|
- { conn_name: 'team-p2p2'}
|
|
|
|
|
- conn_name: em1
|
|
|
|
|
- conn_name: em2
|
|
|
|
|
- conn_name: p1p1
|
|
|
|
|
- conn_name: p1p2
|
|
|
|
|
- conn_name: p2p1
|
|
|
|
|
- conn_name: p2p2
|
|
|
|
|
- conn_name: tenant
|
|
|
|
|
- conn_name: storage
|
|
|
|
|
- conn_name: external
|
|
|
|
|
- conn_name: team-em1
|
|
|
|
|
- conn_name: team-em2
|
|
|
|
|
- conn_name: team-p1p1
|
|
|
|
|
- conn_name: team-p1p2
|
|
|
|
|
- conn_name: team-p2p1
|
|
|
|
|
- conn_name: team-p2p2
|
|
|
|
|
```
|
|
|
|
|
# To add an Ethernet connection with static IP configuration, issue a command as follows
|
|
|
|
|
- nmcli: conn_name=my-eth1 ifname=eth1 type=ethernet ip4=192.168.100.100/24 gw4=192.168.100.1 state=present
|
|
|
|
|
- nmcli:
|
|
|
|
|
conn_name: my-eth1
|
|
|
|
|
ifname: eth1
|
|
|
|
|
type: ethernet
|
|
|
|
|
ip4: 192.0.2.100/24
|
|
|
|
|
gw4: 192.0.2.1
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
# To add an Team connection with static IP configuration, issue a command as follows
|
|
|
|
|
- nmcli: conn_name=my-team1 ifname=my-team1 type=team ip4=192.168.100.100/24 gw4=192.168.100.1 state=present autoconnect=yes
|
|
|
|
|
- nmcli:
|
|
|
|
|
conn_name: my-team1
|
|
|
|
|
ifname: my-team1
|
|
|
|
|
type: team
|
|
|
|
|
ip4: 192.0.2.100/24
|
|
|
|
|
gw4: 192.0.2.1
|
|
|
|
|
state: present
|
|
|
|
|
autoconnect: yes
|
|
|
|
|
|
|
|
|
|
# Optionally, at the same time specify IPv6 addresses for the device as follows:
|
|
|
|
|
- nmcli: conn_name=my-eth1 ifname=eth1 type=ethernet ip4=192.168.100.100/24 gw4=192.168.100.1 ip6=abbe::cafe gw6=2001:db8::1 state=present
|
|
|
|
|
- nmcli:
|
|
|
|
|
conn_name: my-eth1
|
|
|
|
|
ifname: eth1
|
|
|
|
|
type: ethernet
|
|
|
|
|
ip4: 192.0.2.100/24
|
|
|
|
|
gw4: 192.0.2.1
|
|
|
|
|
ip6: '2001:db8::cafe'
|
|
|
|
|
gw6: '2001:db8::1'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
# To add two IPv4 DNS server addresses:
|
|
|
|
|
-nmcli: conn_name=my-eth1 dns4=["8.8.8.8", "8.8.4.4"] state=present
|
|
|
|
|
- nmcli:
|
|
|
|
|
conn_name: my-eth1
|
|
|
|
|
dns4:
|
|
|
|
|
- 192.0.2.53
|
|
|
|
|
- 198.51.100.53
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
# To make a profile usable for all compatible Ethernet interfaces, issue a command as follows
|
|
|
|
|
- nmcli: ctype=ethernet name=my-eth1 ifname="*" state=present
|
|
|
|
|
- nmcli:
|
|
|
|
|
ctype: ethernet
|
|
|
|
|
name: my-eth1
|
|
|
|
|
ifname: *
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
# To change the property of a setting e.g. MTU, issue a command as follows:
|
|
|
|
|
- nmcli: conn_name=my-eth1 mtu=9000 type=ethernet state=present
|
|
|
|
|
- nmcli:
|
|
|
|
|
conn_name: my-eth1
|
|
|
|
|
mtu: 9000
|
|
|
|
|
type: ethernet
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
Exit Status's:
|
|
|
|
|
- nmcli exits with status 0 if it succeeds, a value greater than 0 is
|
|
|
|
|