{"id":13753721,"url":"https://github.com/Juniper/ansible-junos-stdlib","last_synced_at":"2025-05-09T21:35:39.185Z","repository":{"id":13492488,"uuid":"16183015","full_name":"Juniper/ansible-junos-stdlib","owner":"Juniper","description":"Junos modules for Ansible","archived":false,"fork":false,"pushed_at":"2025-04-28T05:48:43.000Z","size":1354,"stargazers_count":318,"open_issues_count":48,"forks_count":163,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-04-28T06:32:47.371Z","etag":null,"topics":["ansible","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Juniper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-23T19:28:58.000Z","updated_at":"2025-04-28T05:48:46.000Z","dependencies_parsed_at":"2022-07-15T14:47:57.147Z","dependency_job_id":"60111563-2000-494a-b12f-4a500c8d42ed","html_url":"https://github.com/Juniper/ansible-junos-stdlib","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fansible-junos-stdlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fansible-junos-stdlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fansible-junos-stdlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fansible-junos-stdlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Juniper","download_url":"https://codeload.github.com/Juniper/ansible-junos-stdlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253329003,"owners_count":21891562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","python"],"created_at":"2024-08-03T09:01:28.215Z","updated_at":"2025-05-09T21:35:39.164Z","avatar_url":"https://github.com/Juniper.png","language":"Python","readme":"[![Documentation Status](https://readthedocs.org/projects/junos-ansible-modules/badge/?version=stable)](https://junos-ansible-modules.readthedocs.io/en/2.3.0/)\n\n# Juniper Ansible collection for Junos\n\n## About\n\nJuniper Networks supports Ansible for managing devices running the Junos operating system (Junos OS and Junos Evolved).\nThis collection is hosted on the Ansible Galaxy website under the collection\n[juniper.device](https://galaxy.ansible.com/ui/repo/published/juniper/device/).\n\nThe `juniper.device` collection includes a set of Ansible modules that perform specific operational and configuration tasks on devices running Junos OS.\nThese tasks include: installing and upgrading Junos OS, provisioning new Junos devices in the network, loading configuration changes,\nretrieving information, and resetting, rebooting, or shutting down managed devices.  Please refer to the\n[INSTALLATION](#installation) section for instructions on installing this collection.\n\n## Two Sets of Ansible Modules for Junos devices\n\nSince Ansible version \u003e= 2.1, Ansible also natively includes\n[core modules for Junos](https://docs.ansible.com/ansible/latest/collections/junipernetworks/junos/index.html#plugins-in-junipernetworks-junos). The Junos modules included\nin Ansible core have names which begin with the prefix `junos_`. The Junos modules included in this `Juniper.device`\ncollection have names starting with module types. These two sets of Junos modules can coexist on the same\nAnsible control machine, and an Ansible playbook may invoke a module from either (or both) sets. Juniper Networks recommends\nusing the modules in `juniper.device` collection when writing new playbooks that manage Junos devices.\n\n## Overview of Modules\n\nThis `juniper.device` collection includes the following modules:\n\n- **command** — Execute one or more CLI commands on a Junos device.\n- **config** — Manipulate the configuration of a Junos device.\n- **facts** — Retrieve facts from a Junos device.\n- **file_copy** - Copy the files from and to a Junos device.\n- **jsnapy** — Execute JSNAPy tests on a Junos device.\n- **ping** — Execute ping from a Junos device.\n- **pmtud** — Perform path MTU discovery from a Junos device to a destination.\n- **rpc** — Execute one or more NETCONF RPCs on a Junos device.\n- **software** — Install software on a Junos device.\n- **srx_cluster** — Add or remove SRX chassis cluster configuration.\n- **system** — Initiate operational actions on the Junos system.\n- **table** — Retrieve data from a Junos device using a PyEZ table/view.\n\n### PyEZ Version Requirement\n\nFor ansible collection `juniper.device` we will need to install [junos-eznc](https://github.com/Juniper/py-junos-eznc) version 2.6.0 or higher.\n\n### Overview of Plugins\n\nIn addition to the modules listed above, a callback_plugin `jsnapy` is available for the module [jsnapy](https://github.com/Juniper/jsnapy).\n\nThe callback_plugin `jsnapy` helps to print on the screen additional information regarding jsnapy failed tests.\nFor each failed test, a log will be printed after the RECAP of the playbook as shown in this example:\n\n    PLAY RECAP *********************************************************************\n    qfx10002-01                : ok=3    changed=0    unreachable=0    failed=1\n    qfx10002-02                : ok=3    changed=0    unreachable=0    failed=1\n    qfx5100-01                 : ok=1    changed=0    unreachable=0    failed=1\n\n    JSNAPy Results for: qfx10002-01 ************************************************\n    Value of 'peer-state' not 'is-equal' at '//bgp-information/bgp-peer' with {\"peer-as\": \"65200\", \"peer-state\": \"Active\", \"peer-address\": \"100.0.0.21\"}\n    Value of 'peer-state' not 'is-equal' at '//bgp-information/bgp-peer' with {\"peer-as\": \"60021\", \"peer-state\": \"Idle\", \"peer-address\": \"192.168.0.1\"}\n    Value of 'oper-status' not 'is-equal' at '//interface-information/physical-interface[normalize-space(admin-status)='up' and logical-interface/address-family/address-family-name ]' with {\"oper-status\": \"down\", \"name\": \"et-0/0/18\"}\n\n    JSNAPy Results for: qfx10002-02 ************************************************\n    Value of 'peer-state' not 'is-equal' at '//bgp-information/bgp-peer' with {\"peer-as\": \"65200\", \"peer-state\": \"Active\", \"peer-address\": \"100.0.0.21\"}\n\nCallback plugins are not activated by default. They must be manually added to the Ansible\nconfiguration file under the `[defaults]` section using the variable `callback_whitelist`. Specifically, these lines\nshould be added to the Ansible configuration file in order to allow the jsnapy callback plugin:\n\n    [defaults]\n    callback_whitelist = jsnapy\n\n## DOCUMENTATION\n\n[Official Juniper documentation](http://www.juniper.net/techpubs/en_US/release-independent/junos-ansible/information-products/pathway-pages/index.html) (detailed information, including examples)\n\n[Ansible style documentation](https://ansible-juniper-collection.readthedocs.io)\n\n## INSTALLATION\n\nYou must have the [DEPENDENCIES](#dependencies) installed on your system.\nCheck requirements.txt for the dependencies.\n\n### NOTICES\n\n### MacOS Mojave and newer\n\nIn MacOS Mojave and newer (\u003e=10.14), ssh keys created with the system `ssh-keygen` are created using the newer 'OPENSSH' key format, even when specifying `-t rsa` during creation. This directly affects the usage of ssh keys, particularly when using the `ssh_private_key_file`. To create/convert/check keys, follow these steps:\n\n- Create a new RSA key: `ssh-keygen -m PEM -t rsa -b 4096`\n- Check existing keys: `head -n1 ~/.ssh/some_private_key` RSA keys will be `-----BEGIN RSA PRIVATE KEY-----` and OPENSSH keys will be `-----BEGIN OPENSSH PRIVATE KEY-----`\n- Convert an OPENSSH key to an RSA key: `ssh-keygen -p -m PEM -f ~/.ssh/some_key`\n\n### Ansible Galaxy collection\n\nYou can use the ansible-galaxy install command to install the latest\nversion of the `juniper.device` collection.\n\n```bash\nsudo ansible-galaxy collection install juniper.device\n```\n\nYou can also use the ansible-galaxy install command to install the latest development version of the junos collections directly from GitHub.\n\n```bash\nsudo ansible-galaxy collection install git+https://github.com/Juniper/ansible-junos-stdlib.git#/ansible_collections/juniper/device\n```\n\nFor more information visit - https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#specifying-the-location-to-search-for-collections\n\n\n### Git clone\n\nFor testing you can `git clone` this repo and run the `env-setup` script in the repo directory:\n\n  user@ansible-junos-stdlib\u003e source env-setup\n\nThis will set your `$ANSIBLE_LIBRARY` variable to the repo location and the installed Ansible library path.  For example:\n\n  $ echo $ANSIBLE_LIBRARY\n  /home/jeremy/Ansible/ansible-junos-stdlib/library:/usr/share/ansible\n\n## Example Playbook\n\nThis example outlines how to use Ansible to install or upgrade the software image on a device running Junos OS.\n\n```yaml\n---\n- name: Install Junos OS\n  hosts: dc1\n  connection: local\n  gather_facts: false\n  vars:\n    wait_time: 3600\n    pkg_dir: /var/tmp/junos-install\n    os_version: 14.1R1.10\n    os_package: jinstall-14.1R1.10-domestic-signed.tgz\n    log_dir: /var/log/ansible\n\n  tasks:\n    - name: Checking NETCONF connectivity\n      ansible.builtin.wait_for:\n        host: \"{{ inventory_hostname }}\"\n        port: 830\n        timeout: 5\n    - name: Install Junos OS package\n      juniper.device.software:\n        reboot: true\n        version: \"{{ os_version }}\"\n        package: \"{{ pkg_dir }}/{{ os_package }}\"\n        logfile: \"{{ log_dir }}/software.log\"\n      register: sw\n      notify:\n        - Wait_reboot\n\n  handlers:\n    - name: Wait_reboot\n      ansible.builtin.wait_for:\n        host: \"{{ inventory_hostname }}\"\n        port: 830\n        timeout: \"{{ wait_time }}\"\n      when: not sw.check_mode\n```\n\n## DEPENDENCIES\n\nThis modules requires the following to be installed on the Ansible control machine:\n\n- Python \u003e= 3.8\n- [Ansible](http://www.ansible.com) 2.9 or later\n- Junos [py-junos-eznc](https://github.com/Juniper/py-junos-eznc) 2.6.0 or later\n- [jxmlease](https://github.com/Juniper/jxmlease) 1.0.1 or later\n- [xmltodict](https://pypi.org/project/xmltodict/) 0.13.0 or later\n- [jsnapy](https://github.com/Juniper/jsnapy) 1.3.7 or later\n\n## LICENSE\n\nApache 2.0\n\n## SUPPORT\n\nSupport for this `juniper.device` collection is provided by the community and Juniper Networks. If you have an\nissue with a module in the `juniper.device` collection, you may:\n\n- Open a [GitHub issue](https://github.com/Juniper/ansible-junos-stdlib/issues).\n- Post a question on our [Google Group](https://groups.google.com/forum/#!forum/junos-python-ez)\n- Email [jnpr-community-netdev@juniper.net](jnpr-community-netdev@juniper.net)\n- Open a [JTAC Case](https://www.juniper.net/casemanager/#/create)\n\nSupport for the Junos modules included in Ansible core is provided by Ansible. If you have an issue with an Ansible\ncore module you should open a [Github issue against the Ansible project](https://github.com/ansible/ansible/issues).\n\n## CONTRIBUTORS\n\nJuniper Networks is actively contributing to and maintaining this repo. Please contact\n[jnpr-community-netdev@juniper.net](jnpr-community-netdev@juniper.net) for any queries.\n\n*Contributors:*\n[Stephen Steiner](https://github.com/ntwrkguru), [Dinesh Babu](https://github.com/dineshbaburam91), [Chidanand Pujar](https://github.com/chidanandpujar)\n\n*Former Contributors:*\n\n[Stacy W Smith](https://github.com/stacywsmith), [Jeremy Schulman](https://github.com/jeremyschulman), [Rick Sherman](https://github.com/shermdog), [Damien Garros](https://github.com/dgarros), [David Gethings](https://github.com/dgjnpr), [Nitin Kumar](https://github.com/vnitinv), [Rahul Kumar](https://github.com/rahkumar651991)\n","funding_links":[],"categories":["python","Python","Non-Core Ansible Modules"],"sub_categories":["NETCONF"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJuniper%2Fansible-junos-stdlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJuniper%2Fansible-junos-stdlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJuniper%2Fansible-junos-stdlib/lists"}