ppouliot.network_appliance_bootstrap
Rol de Ansible: network_appliance_bootstrap
Esta rol de Ansible instalará claves SSH en dispositivos de red usando una conexión SSH. Actualmente se enfoca en dispositivos de red basados en Vyatta, VyOS y dispositivos UBNT.
Variables del Rol:
Las siguientes variables son para dispositivos EdgeRouterX.
netapl_ssh_authorized_key: ~/.ssh/id_ed25519.pub
netapl_device_user_id: ubnt
ansible_network_os: edgeos
ansible_user: ubnt
ansible_pass: <TU_CONTRASEÑA_DE_EDGEROUTER>
ansible_ssh_private_key_file: /etc/ansible/keys/id_rsa
ansible_net_ssh_key_file: /etc/ansible/keys/id_rsa
ansible_python_interpreter: /usr/bin/python
Las siguientes variables son para dispositivos UnFi USG y USG4P.
netapl_ssh_authorized_key: ~/.ssh/id_ed25519.pub
netapl_device_user_id: admin
ansible_network_os: edgeos
ansible_ssh_user: admin
ansible_user: admin
ansible_ssh_pass: <TU_CONTRASEÑA_DE_USG>
ansible_pass: <TU_CONTRASEÑA_DE_USG>
become: yes
ansible_ssh_private_key_file: /etc/ansible/keys/id_rsa
ansible_net_ssh_key_file: /etc/ansible/keys/id_rsa
ansible_python_interpreter: /usr/bin/python
Las siguientes variables son para dispositivos VyOS.
netapl_ssh_authorized_key: ~/.ssh/id_ed25519.pub
netapl_device_user_id: admin
ansible_network_os: vyos
ansible_user: admin
ansible_pass: <TU_CONTRASEÑA_DE_EDGEROUTER>
ansible_ssh_private_key_file: /etc/ansible/keys/id_rsa
ansible_net_ssh_key_file: /etc/ansible/keys/id_rsa
ansible_python_interpreter: /usr/bin/python
Instalación:
ansible-galaxy install ppouliot.network_appliance_bootstrap
Ejemplo de Inventario:
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python"
[usg]
usg4p.pouliot.net
[usg-by-ip]
192.168.1.1
[edgerouterx]
erx.pouliot.net
[edgerouterx-by-ip]
192.168.1.2
[vyos]
vyos.pouliot.net
[vyos-by-ip]
192.168.1.3
[cloudkey]
Unifi-Cloudkey.pouliot.net
[cloudkey-by-ip]
192.168.1.3
[ssh_connection]
pipelining=True
Ejemplo de Playbook
#!/usr/bin/env ansible-playbook
---
- name: Inicialización de SSHKeys para Ansible en UniFi USG
hosts: edgerouterx-by-ip
connection: ssh
become: yes
become_user: root
gather_facts: yes
tasks:
- debug: var=ansible_connection
roles:
- ppouliot.network_appliance_bootstrap
- hosts: edgerouterx
connection: network_cli
gather_facts: false
tasks:
- name: Recopilar información de dispositivos EdgeOS
edgeos_facts:
gather_subset: all
- name: Inicialización de SSHKeys para Ansible en UniFi USG
hosts: usg-by-ip
connection: ssh
become: yes
become_user: root
gather_facts: false
tasks:
- debug: var=ansible_connection
roles:
- ppouliot.network_appliance_bootstrap
- hosts: usg
connection: network_cli
gather_facts: false
tasks:
- name: Recopilar información de dispositivos Unifi
edgeos_facts:
gather_subset: all
- name: Inicialización de SSHKeys para Ansible en VyOS
hosts: vyos-by-ip
connection: ssh
become: yes
become_user: root
gather_facts: false
tasks:
- debug: var=ansible_connection
roles:
- ppouliot.network_appliance_bootstrap
- hosts: vyos
connection: network_cli
gather_facts: false
tasks:
- name: Recopilar información de dispositivos VyOS
vyos_facts:
gather_subset: all
Contribuyentes:
- Peter Pouliot peter@pouliot.net
Derechos de Autor y Licencia:
Derechos de autor (C) 2018 Peter J. Pouliot
Peter Pouliot puede ser contactado en: peter@pouliot.net
Licenciado bajo la Licencia Apache, Versión 2.0 (la "Licencia"); no puedes usar este archivo excepto en cumplimiento con la Licencia. Puedes obtener una copia de la Licencia en
http://www.apache.org/licenses/LICENSE-2.0
A menos que lo exija la ley aplicable o se acuerde por escrito, el software distribuido bajo la Licencia se distribuye "TAL CUAL", SIN GARANTÍAS O CONDICIONES DE NINGÚN TIPO, ya sean expresas o implícitas. Consulta la Licencia para los permisos específicos y limitaciones bajo la Licencia.
Ansible to bootstrap ssh on Vyatta, VyOS & UBNT USG/EdgeRouters
ansible-galaxy install ppouliot.network_appliance_bootstrap