mirror of
https://gitea.0xace.cc/ansible-galaxy/network.git
synced 2024-11-25 06:37:37 +00:00
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
---
|
|
- block:
|
|
- name: "{{ iface.name }} | Configure interface"
|
|
template:
|
|
src: "ifcfg-{{ iface.type | default('ethernet') }}.j2"
|
|
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ iface.name }}"
|
|
notify:
|
|
- Reload interface with ifdown ; ifup
|
|
register: configure_interface
|
|
|
|
- name: "{{ iface.name }} | Add interface to reload list"
|
|
set_fact:
|
|
reload_interfaces: "{{ reload_interfaces + [ iface.name ] }}"
|
|
when: configure_interface.changed
|
|
|
|
- name: "{{ iface.name }} | Create routing rules for interface"
|
|
template:
|
|
src: rule.j2
|
|
dest: "/etc/sysconfig/network-scripts/rule-{{ iface.name }}"
|
|
notify:
|
|
- 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
|
|
|
|
- name: "{{ iface.name }} | Create routes for interface"
|
|
template:
|
|
src: route.j2
|
|
dest: "/etc/sysconfig/network-scripts/route-{{ iface.name }}"
|
|
notify:
|
|
- Reload interface with ifdown ; ifup
|
|
register: create_routes
|
|
|
|
- name: "{{ iface.name }} | Add interface to reload list"
|
|
set_fact:
|
|
reload_interfaces: "{{ reload_interfaces + [ iface.name ] }}"
|
|
when: create_routes.changed
|