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

Remove gateway from /etc/sysconfig/network file #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 12 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
when: ansible_os_family == 'Debian'


- name: Remove gateway from /etc/sysconfig/network file
lineinfile: dest=/etc/sysconfig/network regexp=^GATEWAY= state=absent
when: ansible_os_family == 'RedHat'

- name: Make sure the include line is there in interfaces file
lineinfile: >
regexp="^source\ \/etc\/network\/interfaces.d\/\*"
Expand All @@ -35,7 +39,7 @@
register: ether_result

- name: Write configuration files for rhel route configuration
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
with_items: network_ether_interfaces
when: network_ether_interfaces is defined and item.route is defined and ansible_os_family == 'RedHat'

Expand All @@ -46,24 +50,24 @@
- name: Create the network configuration file for bridge devices
template: src=bridge_{{ ansible_os_family }}.j2 dest={{ net_path }}/ifcfg-{{ item.device }}
with_items: network_bridge_interfaces
when: network_bridge_interfaces is defined
when: network_bridge_interfaces is defined
register: bridge_result

- name: Write configuration files for rhel route configuration
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
with_items: network_bridge_interfaces
when: network_bridge_interfaces is defined and item.route is defined and ansible_os_family == 'RedHat'

- shell: ifdown {{ item.item.device }}; ifup {{ item.item.device }}
with_items: bridge_result.results
when: bridge_result is defined and item.changed

- name: Create the network configuration file for port on the bridge devices
template: src=bridge_port_{{ ansible_os_family }}.j2 dest={{ net_path }}/ifcfg-{{ item.1 }}
with_subelements:
with_subelements:
- network_bridge_interfaces
- ports
when: network_bridge_interfaces is defined
when: network_bridge_interfaces is defined
register: bridge_port_result

- shell: ifdown {{ item.item.1 }}; ifup {{ item.item.1 }}
Expand All @@ -81,7 +85,7 @@
when: bond_result|changed

- name: Write configuration files for route configuration
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
with_items: network_bond_interfaces
when: network_bond_interfaces is defined and item.route is defined and ansible_os_family == 'RedHat'

Expand All @@ -91,7 +95,7 @@

- name: Create the network configuration file for slave in the bond devices
template: src=bond_slave_{{ ansible_os_family }}.j2 dest={{ net_path }}/ifcfg-{{ item.1 }}
with_subelements:
with_subelements:
- network_bond_interfaces
- bond_slaves
when: network_bond_interfaces is defined
Expand Down