95 lines
2.1 KiB
Markdown
95 lines
2.1 KiB
Markdown
based on:
|
|
|
|
https://github.com/dresden-weekly/ansible-network-interfaces (https://galaxy.ansible.com/dresden-weekly/network-interfaces/)
|
|
|
|
|
|
Example Playbook
|
|
----------------
|
|
|
|
```yml
|
|
- hosts: all
|
|
become: true
|
|
become_user: root
|
|
|
|
roles:
|
|
- role: dresden-weekly.network-interfaces
|
|
|
|
network_interfaces:
|
|
- device: eth0
|
|
description: just a description for humans to understand
|
|
auto: true
|
|
family: inet
|
|
method: static
|
|
address: 192.168.1.11
|
|
network: 192.168.1.0
|
|
netmask: 193.168.1.255
|
|
gateway: 192.168.1.1
|
|
mtu: 9000
|
|
metric: 1
|
|
nameservers:
|
|
- 8.8.8.8
|
|
- 8.8.4.4
|
|
subnets:
|
|
- 192.168.1.12/32
|
|
|
|
- device: eth1
|
|
description: simple dhcp client interface
|
|
auto: true
|
|
family: inet
|
|
method: dhcp
|
|
|
|
- device: wlan0
|
|
description: sample wlan interface using wpa_supplicant (note: does not install wpasupplicant)
|
|
auto: true
|
|
family: inet
|
|
method: dhcp
|
|
additional_options:
|
|
wpa-driver: nl80211
|
|
wpa-ssid: my-wifi
|
|
wpa-psk: password123
|
|
|
|
- device: eth0.123
|
|
description: sample vlan interface using eth0 and tagged for VLAN 123.
|
|
method: static
|
|
address: 1.2.3.4
|
|
netmask: 24
|
|
broadcast: 1.2.3.255
|
|
vlan:
|
|
raw-device: eth0
|
|
up:
|
|
- route add default gw 1.2.3.254
|
|
|
|
- device: eth2
|
|
description: First bonding device
|
|
auto: true
|
|
family: inet
|
|
method: manual
|
|
bond:
|
|
master: bond0
|
|
|
|
- device: eth3
|
|
description: Second bonding device
|
|
auto: true
|
|
family: inet
|
|
method: manual
|
|
bond:
|
|
master: bond0
|
|
|
|
- device: bond0
|
|
description: This bonding device only has one interface
|
|
allow:
|
|
- hotplug
|
|
family: inet
|
|
method: static
|
|
bond:
|
|
mode: 802.3ad
|
|
xmit-hash-policy: layer3+4
|
|
miimon: 100
|
|
slaves: eth2 eth3
|
|
address: 192.160.50.1
|
|
netmask: 255.255.255.0
|
|
dns_search: "localdomain"
|
|
up:
|
|
- ip route add 172.16.0.0/24 via 192.168.50.254 dev bond0
|
|
```
|