Set up custom network interface configurations for a server.
network_ifaces: A list of dictionaries, one per network device, of network parameters which will be substituted into
network_ifaces.device: The device name. All other fields are optional, see the template for details.
network_ifaces.bondmaster: If specified this NIC will be part of a bonded interface. If the
bondmasterit will be set as the master, otherwise it will be a slave of
network_disable_ifaces: A list of network device names to be explicitly disabled, use this if you want to be sure the interface is disabled (as opposed to being auto-configured by the system).
network_delete_ifaces: A regular expression describing the network device name(s) to be removed (note this means the system may auto-configure them), use this for cleaning up spare configuration files.
network_additional_params: A dictionary containing additional parameters to be added to the interface configuration file. Keys will be set to upper case, and values will be set as supplied. Add this to the list of dictionaries,
The set of network parameters which can be defined in
network_ifaces are as follows. If these are not defined, and the parameter has a default value, it will be added with that default value.
- bondmaster (not a parameter, per se, but configures bonding. See example below.)
- bootproto (default: none)
- ipv6init (default: yes)
ONBOOT=yes is set by default, and is not configurable.
# Simple network - hosts: localhost roles: - role: ome.network network_ifaces: - device: eth0 ip: 192.168.1.1 netmask: 255.255.255.0 type: ethernet gateway: 192.168.1.254 dns1: 18.104.22.168 dns2: 22.214.171.124 network_additional_params: ipv6_autoconf: "no" # Bonded network combining eth0 and eth1 - hosts: localhost roles: - role: ome.network network_ifaces: - device: bond0 ip: 192.168.1.1 prefix: 24 gateway: 192.168.1.254 dns1: 126.96.36.199 dns2: 188.8.131.52 bondmaster: bond0 - device: eth0 bondmaster: bond0 - device: eth1 bondmaster: bond0
- If you change the network settings it may be restarted, which means your connection from Ansible may be broken.
- In some cases restarting the network is insufficient, you may need to reboot.
- If you are using this role to set a network IP after a system has been PXEed you may need to temporarily set
ansible_hostin your host inventory if DNS isn't already setup for the host.