diff --git a/tasks/main.yml b/tasks/main.yml index b8b827a..e7c5093 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -104,3 +104,12 @@ - shell: ifdown {{ item.item.device }}; ifup {{ item.item.device }} with_items: bond_result.results when: bond_result is defined and item.changed and ansible_os_family == 'RedHat' + +- name: Reload facts + setup: + when: > + ether_result is defined or + bridge_result is defined or + bridge_port_result is defined or + bond_result is defined or + bond_port_result is defined diff --git a/templates/bond_Debian.j2 b/templates/bond_Debian.j2 index 9f65d7c..218163a 100644 --- a/templates/bond_Debian.j2 +++ b/templates/bond_Debian.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + auto {{ item.device }} {% if item.bootproto == 'static' %} iface {{ item.device }} inet static diff --git a/templates/bond_RedHat.j2 b/templates/bond_RedHat.j2 index 7073c9d..d9d25da 100644 --- a/templates/bond_RedHat.j2 +++ b/templates/bond_RedHat.j2 @@ -1,3 +1,8 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# {% if item.bootproto == 'static' %} DEVICE={{ item.device }} @@ -24,4 +29,7 @@ BONDING_OPTS="mode={{ item.bond_mode }} miimon={{ item.bond_miimon|default(100) USERCTL=no ONBOOT={{ item.onboot|default("yes") }} BOOTPROTO=dhcp +{% if item.peerdns is defined %} +PEERDNS={{ item.peerdns }} +{% endif %} {% endif %} diff --git a/templates/bond_slave_Debian.j2 b/templates/bond_slave_Debian.j2 index 1cdd47e..daf282c 100644 --- a/templates/bond_slave_Debian.j2 +++ b/templates/bond_slave_Debian.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + auto {{ item.1 }} iface {{ item.1 }} inet manual bond-master {{ item.0.device }} diff --git a/templates/bond_slave_RedHat.j2 b/templates/bond_slave_RedHat.j2 index d70e185..70c4500 100644 --- a/templates/bond_slave_RedHat.j2 +++ b/templates/bond_slave_RedHat.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + DEVICE={{ item.1 }} BOOTPROTO=none MASTER={{ item.0.device }} diff --git a/templates/bonding.conf.j2 b/templates/bonding.conf.j2 index 475cfe6..5d500bb 100644 --- a/templates/bonding.conf.j2 +++ b/templates/bonding.conf.j2 @@ -1 +1,7 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + options bonding diff --git a/templates/bridge_Debian.j2 b/templates/bridge_Debian.j2 index 5a74afd..ec8c029 100644 --- a/templates/bridge_Debian.j2 +++ b/templates/bridge_Debian.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + auto {{ item.device }} {% if item.bootproto == 'static' %} iface {{ item.device }} inet static diff --git a/templates/bridge_RedHat.j2 b/templates/bridge_RedHat.j2 index 9b69c6b..0dcea71 100644 --- a/templates/bridge_RedHat.j2 +++ b/templates/bridge_RedHat.j2 @@ -1,3 +1,8 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# {% if item.bootproto == 'static' %} DEVICE={{ item.device }} @@ -27,4 +32,7 @@ BOOTPROTO=dhcp {% if item.stp is defined %} STP={{ item.stp }} {% endif %} +{% if item.peerdns is defined %} +PEERDNS={{ item.peerdns }} +{% endif %} {% endif %} diff --git a/templates/bridge_port_Debian.j2 b/templates/bridge_port_Debian.j2 index 06b976e..4f2c8fc 100644 --- a/templates/bridge_port_Debian.j2 +++ b/templates/bridge_port_Debian.j2 @@ -1,2 +1,8 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + auto {{ item.1 }} iface {{ item.1 }} inet manual diff --git a/templates/bridge_port_RedHat.j2 b/templates/bridge_port_RedHat.j2 index 4ab9bdb..c779175 100644 --- a/templates/bridge_port_RedHat.j2 +++ b/templates/bridge_port_RedHat.j2 @@ -1,3 +1,8 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# DEVICE={{ item.1 }} TYPE=Ethernet diff --git a/templates/ethernet_Debian.j2 b/templates/ethernet_Debian.j2 index fba82e1..8db3bdc 100644 --- a/templates/ethernet_Debian.j2 +++ b/templates/ethernet_Debian.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + {% if item.bootproto == 'static' %} auto {{ item.device }} iface {{ item.device }} inet static diff --git a/templates/ethernet_RedHat.j2 b/templates/ethernet_RedHat.j2 index b695bff..ea7decb 100644 --- a/templates/ethernet_RedHat.j2 +++ b/templates/ethernet_RedHat.j2 @@ -1,22 +1,35 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# -{% if item.bootproto == 'static' %} DEVICE={{ item.device }} +{% if item.onboot is defined %} +ONBOOT={{ item.onboot }} +{% endif %} +{% if item.bootproto == 'dhcp' %} +BOOTPROTO=dhcp +{% if item.peerdns is defined %} +PEERDNS={{ item.peerdns }} +{% endif %} +{% endif -%} + +{% if item.bootproto == 'static' %} BOOTPROTO=none {% if item.address is defined %} IPADDR={{ item.address }} {% endif %} -{% if item.onboot is defined %} -ONBOOT={{ item.onboot }} -{% endif %} {% if item.netmask is defined %} NETMASK={{ item.netmask }} {% endif %} {% if item.gateway is defined %} GATEWAY={{ item.gateway }} {% endif %} +{% if item.dns1 is defined %} +DNS1={{ item.dns1 }} +{% endif %} +{% if item.dns2 is defined %} +DNS2={{ item.dns2 }} {% endif %} - -{% if item.bootproto == 'dhcp' %} -DEVICE={{ item.device }} -BOOTPROTO=dhcp {% endif %} diff --git a/templates/route_Debian.j2 b/templates/route_Debian.j2 index df4e07c..f14626e 100644 --- a/templates/route_Debian.j2 +++ b/templates/route_Debian.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + {% for i in item.route %} up route add -net {{ i.network }} netmask {{ i.netmask }} gw {{ i.gateway }} dev {{ item.device }} {% endfor %} diff --git a/templates/route_RedHat.j2 b/templates/route_RedHat.j2 index 231d4b3..43fefe8 100644 --- a/templates/route_RedHat.j2 +++ b/templates/route_RedHat.j2 @@ -1,3 +1,9 @@ +# +# This file is managed by Ansible. +# Do not edit this file manually. +# Any changes will be automatically reverted. +# + {% for i in item.route %} ADDRESS{{ loop.index - 1 }}={{ i.network }} NETMASK{{ loop.index - 1 }}={{ i.netmask }}