2021-10-26 21:34:13 +00:00
|
|
|
---
|
|
|
|
- block:
|
2021-10-27 14:19:40 +00:00
|
|
|
- name: "{{ iface.name }} | Configure interface"
|
2021-10-26 21:34:13 +00:00
|
|
|
template:
|
2021-10-27 14:19:40 +00:00
|
|
|
src: "ifcfg-{{ iface.type | default('ethernet') }}.j2"
|
|
|
|
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ iface.name }}"
|
2021-10-26 21:34:13 +00:00
|
|
|
notify:
|
2021-10-27 14:19:40 +00:00
|
|
|
- Reload interface with ifdown ; ifup
|
|
|
|
register: configure_interface
|
2021-10-26 21:34:13 +00:00
|
|
|
|
2021-10-27 14:19:40 +00:00
|
|
|
- name: "{{ iface.name }} | Add interface to reload list"
|
|
|
|
set_fact:
|
|
|
|
reload_interfaces: "{{ reload_interfaces + [ iface.name ] }}"
|
|
|
|
when: configure_interface.changed
|
2021-10-26 21:34:13 +00:00
|
|
|
|
2021-10-27 14:19:40 +00:00
|
|
|
- name: "{{ iface.name }} | Create routing rules for interface"
|
2021-10-26 21:34:13 +00:00
|
|
|
template:
|
|
|
|
src: rule.j2
|
2021-10-27 14:19:40 +00:00
|
|
|
dest: "/etc/sysconfig/network-scripts/rule-{{ iface.name }}"
|
2021-10-26 21:34:13 +00:00
|
|
|
notify:
|
2021-10-27 14:19:40 +00:00
|
|
|
- Reload interface with ifdown ; ifup
|
|
|
|
register: create_routing_rules
|
|
|
|
|
|
|
|
- name: "{{ iface.name }} | Add interface to reload list"
|
|
|
|
set_fact:
|
|
|
|
reload_interfaces: "{{ reload_interfaces + [ iface.name ] }}"
|
|
|
|
when: create_routing_rules.changed
|
2021-10-26 21:34:13 +00:00
|
|
|
|
2021-10-27 14:19:40 +00:00
|
|
|
- name: "{{ iface.name }} | Create routes for interface"
|
2021-10-26 21:34:13 +00:00
|
|
|
template:
|
|
|
|
src: route.j2
|
2021-10-27 14:19:40 +00:00
|
|
|
dest: "/etc/sysconfig/network-scripts/route-{{ iface.name }}"
|
2021-10-26 21:34:13 +00:00
|
|
|
notify:
|
2021-10-27 14:19:40 +00:00
|
|
|
- Reload interface with ifdown ; ifup
|
|
|
|
register: create_routes
|
2021-10-26 21:34:13 +00:00
|
|
|
|
2021-10-27 14:19:40 +00:00
|
|
|
- name: "{{ iface.name }} | Add interface to reload list"
|
|
|
|
set_fact:
|
|
|
|
reload_interfaces: "{{ reload_interfaces + [ iface.name ] }}"
|
|
|
|
when: create_routes.changed
|