Project to demonstrate Ansible modules for Junos
In this project you'll find:
- Examples of playbooks for various Ansible modules for Junos:
- core - junos_config: add config, delete config, rollback
- core - junos_facts: collect facts, collect configuration in XML, TEXT or JSON
- core - junos_command: execute cli commands or RPC on devices
- core - junos_template: deploy configuration templates on device
- Vagrant file to start a virtual topology with 2 vSRX
A virtual topology based on Vagrant and vSRX is provided to help everyone to get started.
Vagrant installation instructions Vagrant plugin installation
vagrant plugin add vagrant-junos
Once Vagrant is installed, you can start the topology
git clone https://github.com/JNPRAutomate/ansible-junos-examples.git
cd ansible-junos-examples
vagrant up
2 devices will be started (vsrx1 & vsrx2). Both devices are connected back to back with 2 interfaces.
ge-0/0/0| ge-0/0/0|
============= =============
| | ge-0/0/[1-2] | |
| vsrx1 | ------------- | vsrx2 |
| | ------------- | |
============= =============
You can connect to both VM in SSH
vagrant ssh vsrx1
vagrant ssh vsrx2
All playbooks are located in the directory playbook-core/
Official documentation on Ansible Website
ansible-playbook playbook-core/pb.config.update_hostname.yaml
this operation is idempotent, if executed twice, Ansible will not report change the second time.
ansible-playbook playbook-core/pb.config.add_description.yaml
ansible-playbook playbook-core/pb.config.delete_description.yaml
ansible-playbook playbook-core/pb.config.rollback.yaml
Official documentation on Ansible Website
ansible-playbook playbook-core/pb.command.show_version.yaml
ansible-playbook playbook-core/pb.command.show_interface.yaml
ansible-playbook playbook-core/pb.command.show_ext_if_up.yaml
Official documentation on Ansible Website
The configuration will be automatically converted from XML to JSON
ansible-playbook playbook-core/pb.facts.get_config_json_xml.yaml
ansible-playbook playbook-core/pb.facts.get_config_txt.yaml
Official documentation on Ansible Website
ansible-playbook playbook-core/pb.template.push_interface.yaml
Official documentation on Ansible Website.
Example not available yet
Official documentation on Ansible Website.
Example not available yet
ansible-playbook playbook-galaxy/pb.jsnapy.test_pass.yaml
ansible-playbook playbook-galaxy/pb.jsnapy.template_test.yaml
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet
Example not available yet