--- - name: Configure network with network-scripts when: network.network_scripts is defined block: - name: Install network scripts package: name: network-scripts state: present - name: Create routing table in rt_tables template: src: rt_tables.j2 dest: /etc/iproute2/rt_tables - name: Configure interfaces and routes with network-scripts vars: iface: "{{ item }}" include_tasks: network_scripts.yaml loop: "{{ network.network_scripts.iface }}" - name: Configure network with Network Manager when: network.network_manager is defined block: - name: Install NetworkManager-dispatcher-routing-rules package: name: - NetworkManager-dispatcher-routing-rules state: present when: ansible_distribution_major_version == '7' - name: Configure interfaces and routes with nmcli vars: iface: "{{ item }}" include_tasks: network_manager.yaml loop: "{{ network.network_manager.iface }}"