--- - name: Configurar routers Cisco hosts: routers gather_facts: no become: yes vars: # for execution environment ansible_connection: ansible.netcommon.network_cli ansible_network_os: cisco.ios.ios ansible_user: vagrant ansible_password: vagrant tasks: - name: Configurar interfaces GigabitEthernet ansible.netcommon.cli_command: command: "{{ item }}" loop: - "enable" - "configure terminal" - "interface GigabitEthernet1" - "ip address {{ wan_ip }} 255.255.255.0" - "no shutdown" - "exit" - "interface GigabitEthernet2" - "ip address {{ lan_ip }} 255.255.255.0" - "no shutdown" - "exit" vars: wan_ip: "{{ wan_interface_ip }}" lan_ip: "{{ lan_interface_ip }}" - name: Configurar RIPv2 en el router ansible.netcommon.cli_command: command: "{{ item }}" loop: - "enable" - "configure terminal" - "router rip" - "version 2" - "network {{ wan }}" - "network {{ lan }}" - "no auto-summary" vars: wan: "{{ wan_network }}" lan: "{{ lan_network }}" - name: Guardar la configuración en la NVRAM ansible.netcommon.cli_command: command: "{{ item }}" loop: - "enable" # - "configure terminal" - "write memory" # - name: Reiniciar los routers # reboot: # reboot_timeout: 300