Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »


https://junos-ansible-modules.readthedocs.io/en/2.3.0/juniper_junos_rpc.html


Authentification:

https://www.juniper.net/documentation/en_US/junos-ansible/topics/task/configuration/junos-ansible-authenticating-users.html




rpc command
rpc command
root@SRX300-1-RL102> show chassis hardware detail | display xml rpc
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/19.4R0/junos">
    <rpc>
        <get-chassis-inventory>
                <detail/>
        </get-chassis-inventory>
    </rpc>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>



ssh root@172.30.95.174 -p 830 -s netconf 


Ansible hosts file
hosts
labuser@saltsackmaster:~/project/ansible/gethw$ more hosts
[All-devices]

[All-srx]
172.30.95.174

[QFX5100]
172.30.95.177

[EX4300]
172.30.95.194

Ansible playbook
playbook
---
- name: Get facts
  hosts: All-srx
  connection: local
  gather_facts: no
  roles:
    - Juniper.junos

  tasks:
    - name: Get Chassis information
      juniper_junos_rpc:
        host: "{{ inventory_hostname }}"
        user: "Netbox"
        passwd: "Netbox"
        #savedir: "{{playbook_dir}}/inventory"
        rpcs:
          - "get-chassis-inventory"
        kwargs:
          - detail: True
        formats: "xml"
        dest: "chassis_hardware.xml"
      register: junos
    - name: Print facts
      debug:
        var: junos.stdout







  • No labels