--- - 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