Ad Home

Ansible Basic Configuration - Funciona OK

Share:

 ##### ansible.cfg
[defaults]
host_key_checking = False
inventory = ./hosts

##### hosts
all:
  vars:
    ansible_user: cisco
    ansible_password: cisco
    ansible_connection: ansible.netcommon.network_cli
    ansible_network_os: cisco.ios.ios
    ansible_become: yes
    ansible_become_method: enable
    ansible_become_password: cisco
    ansible_host_key_auto_add: yes

routers:
  hosts:
    r11:
      ansible_host: 192.168.80.40
    r12:
      ansible_host: 192.168.80.43
    r14:
      ansible_host: 192.168.80.44

##### playbook.yml
---
-
  name: Sending IOS Commands
  hosts: routers
  gather_facts: no

  tasks:

  - name: Sending a few simple Cisco IOS commands
    cisco.ios.ios_command:
      commands:
        - conf t
        - int loop 1
        - ip add 1.1.1.1 255.255.255.0
        - int loop 2
        - ip add 2.2.2.2 255.255.255.0

### Comando para ejecutar el playbook

ansible-playbook -i /ruta/a/hosts/ playbook.yml

No hay comentarios

COMENTA CON TU PERFIL DEFACEBOK

Ad Home