--- - hosts: all become: true vars: ip_address: R01: - 10.10.1.1/24 - 10.20.1.1/24 - 10.100.1.1/24 R02: - 10.10.1.2/24 - 10.30.1.1/24 - 10.200.1.1/24 R03: - 10.20.1.2/24 - 10.30.1.2/24 R04: - 10.100.1.2/24 R05: - 10.100.2.2/24 tasks: - name: update apt: update_cache: yes - name: install frr apt: name: frr state: present - name: enable ospfd lineinfile: path: /etc/frr/daemons regexp: '^ospfd=' line: 'ospfd=yes' notify: restart frr - name: copy template frr conf template: src: frr.template dest: /etc/frr/frr.conf notify: restart frr - name: deploy files ansible_conf_frr include_tasks: ansible_conf_frr.yml loop: "{{ ip_address[inventory_hostname] }}" - name: enable ospf frr blockinfile: path: /etc/frr/frr.conf block: | ! router ospf network 10.0.0.0/8 area 0 exit marker: "" notify: restart frr handlers: - name: restart frr systemd: name: frr state: restarted