Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethernet configuration fix #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions templates/bond_Debian.j2
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions templates/bond_RedHat.j2
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -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 %}
6 changes: 6 additions & 0 deletions templates/bond_slave_Debian.j2
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 6 additions & 0 deletions templates/bond_slave_RedHat.j2
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
6 changes: 6 additions & 0 deletions templates/bonding.conf.j2
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
#
# This file is managed by Ansible.
# Do not edit this file manually.
# Any changes will be automatically reverted.
#

options bonding
6 changes: 6 additions & 0 deletions templates/bridge_Debian.j2
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions templates/bridge_RedHat.j2
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -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 %}
6 changes: 6 additions & 0 deletions templates/bridge_port_Debian.j2
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions templates/bridge_port_RedHat.j2
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions templates/ethernet_Debian.j2
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 21 additions & 8 deletions templates/ethernet_RedHat.j2
Original file line number Diff line number Diff line change
@@ -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 %}
6 changes: 6 additions & 0 deletions templates/route_Debian.j2
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
6 changes: 6 additions & 0 deletions templates/route_RedHat.j2
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down