Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 29 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@

Juniper Networks provides support for using Ansible to deploy devices running the Junos operating system (Junos OS). The Juniper Networks Ansible library, which is hosted on the Ansible Galaxy website under the role [junos](https://galaxy.ansible.com/list#/roles/1116), enables you to use Ansible to perform specific operational and configuration tasks on devices running Junos OS, including installing and upgrading Junos OS, deploying specific devices in the network, loading configuration changes, retrieving information, and resetting, rebooting, or shutting down managed devices. Please refer to [INSTALLATION](#installation) section for setup.

In addition to these modules, Since 2.1, Ansible natively include some [core modules for Junos](http://docs.ansible.com/ansible/list_of_network_modules.html#junos). Both Core and Galaxy modules can cohexist on the same platform.

## OVERVIEW OF MODULES

- junos_get_facts — Retrieve device-specific information from the host.
- junos_rpcTo execute RPC on device and save output locally
- junos_cliTo execute CLI on device and save output locally
- junos_commitCommit candidate configuration on device.
- junos_get_configRetrieve configuration of device.
- junos_install_configModify the configuration of a device running Junos OS.
- junos_install_osInstall a Junos OS software package.
- junos_rollbackRollback configuration of device.
- junos_shutdownShut down or reboot a device running Junos OS.
- junos_srx_cluster — Enable/Disable cluster mode for SRX devices
- junos_zeroize — Remove all configuration information on the Routing Engines and reset all key values on a device.
- junos_get_table - Retrieve data from a Junos device using Tables/Views
- junos_ping - execute ping on junos devices
- junos_jsnapy - Integrate JSNAPy to ansible which helps audit network devices
- **junos_get_facts** — Retrieve device-specific information from the host.
- **junos_commit**Commit candidate configuration on device.
- **junos_get_config**Retrieve configuration of device.
- **junos_install_config**Modify the configuration of a device running Junos OS.
- **junos_install_os**Install a Junos OS software package.
- **junos_rollback**Rollback configuration of device.
- **junos_shutdown**Shut down or reboot a device running Junos OS.
- **junos_srx_cluster**Enable/Disable cluster mode for SRX devices
- **junos_zeroize**Remove all configuration information on the Routing Engines and reset all key values on a device.
- **junos_get_table** - Retrieve data from a Junos device using Tables/Views
- **junos_ping** - execute ping on junos devices
- **junos_jsnapy** - Integrate JSNAPy to ansible which helps audit network devices
- **junos_rpc** — To execute RPC on device and save output locally
- **junos_cli** — To execute CLI on device and save output locally

### OVERVIEW OF PLUGINS

Expand Down Expand Up @@ -74,20 +76,20 @@ To download the junos role to the Ansible server, execute the ansible-galaxy ins

### Git clone
For testing you can `git clone` this repo and run the `env-setup` script in the repo directory:

user@ansible-junos-stdlib> source env-setup

```
user@ansible-junos-stdlib> source env-setup
```
This will set your `$ANSIBLE_LIBRARY` variable to the repo location and the installed Ansible library path. For example:

````
```
[jeremy@ansible-junos-stdlib]$ echo $ANSIBLE_LIBRARY
/home/jeremy/Ansible/ansible-junos-stdlib/library:/usr/share/ansible
````
```

## Example Playbook
This example outlines how to use Ansible to install or upgrade the software image on a device running Junos OS.

```
```yaml
---
- name: Install Junos OS
hosts: dc1
Expand All @@ -107,11 +109,11 @@ This example outlines how to use Ansible to install or upgrade the software imag
wait_for: host={{ inventory_hostname }} port=830 timeout=5
- name: Install Junos OS package
junos_install_os:
host={{ inventory_hostname }}
reboot=yes
version={{ OS_version }}
package={{ pkg_dir }}/{{ OS_package }}
logfile={{ log_dir }}/software.log
host: "{{ inventory_hostname }}"
reboot: yes
version: "{{ OS_version }}"
package: "{{ pkg_dir }}/{{ OS_package }}"
logfile: "{{ log_dir }}/software.log"
register: sw
notify:
- wait_reboot
Expand All @@ -128,8 +130,7 @@ Thes modules require the following to be installed on the Ansible server:

* Python 2.6 or 2.7
* [Ansible](http://www.ansible.com) 1.5 or later
* Junos [py-junos-eznc](https://github.com/Juniper/py-junos-eznc) 1.2.2 or later
* Junos [netconify](https://github.com/jeremyschulman/py-junos-netconify) 1.0.1 or later (if using console)
* Junos [py-junos-eznc](https://github.com/Juniper/py-junos-eznc) 1.2.2 or later (2.0.0 if you want to use the mode: telnet)

## LICENSE

Expand All @@ -141,7 +142,7 @@ Juniper Networks is actively contributing to and maintaining this repo. Please c

*Contributors:*

[Nitin Kumar](https://github.com/vnitinv), [Stacy W Smith](https://github.com/stacywsmith), [David Gethings](https://github.com/dgjnpr)
[Nitin Kumar](https://github.com/vnitinv), [Stacy W Smith](https://github.com/stacywsmith), [David Gethings](https://github.com/dgjnpr), [Damien Garros](https://github.com/dgarros)

*Former Contributors:*

Expand Down