ppouliot.network_appliance_bootstrap
Ansible Role: network_appliance_bootstrap
This Ansible role helps set up SSH keys on network devices via SSH. It currently supports devices like Vyatta, VyOS, and UBNT.
Role Variables:
For EdgeRouterX devices:
netapl_ssh_authorized_key: ~/.ssh/id_ed25519.pub
netapl_device_user_id: ubnt
ansible_network_os: edgeos
ansible_user: ubnt
ansible_pass: <YOUR_EDGEROUTER_PASSWORD>
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
For UnFi USG and USG4P devices:
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: <YOUR_USG_PASSWORD>
ansible_pass: <YOUR_USG_PASSWORD>
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
For VyOS devices:
netapl_ssh_authorized_key: ~/.ssh/id_ed25519.pub
netapl_device_user_id: admin
ansible_network_os: vyos
ansible_user: admin
ansible_pass: <YOUR_EDGEROUTER_PASSWORD>
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
Installation:
To install this role, run:
ansible-galaxy install ppouliot.network_appliance_bootstrap
Example Inventory:
Here is an example of how to set up your inventory:
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
Example Playbook:
Here’s a sample playbook that uses the role:
#!/usr/bin/env ansible-playbook
---
- name: UniFi USG Bootstrap SSHKeys for Ansible
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: Collect facts from EdgeOS Devices
edgeos_facts:
gather_subset: all
- name: UniFi USG Bootstrap SSHKeys for Ansible
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: Collect facts from Unifi Devices
edgeos_facts:
gather_subset: all
- name: VyOS Bootstrap SSHKeys for Ansible
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: Collect facts from VyOS Devices
vyos_facts:
gather_subset: all
Contributors:
- Peter Pouliot peter@pouliot.net
Copyright and License:
- Copyright (C) 2018 Peter J. Pouliot
- Licensed under the Apache License, Version 2.0. You can find the License here.
Informazioni sul progetto
Ansible to bootstrap ssh on Vyatta, VyOS & UBNT USG/EdgeRouters
Installa
ansible-galaxy install ppouliot.network_appliance_bootstrap
Licenza
Unknown
Download
224
Proprietario