Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: GET
- hosts: fw
- roles:
- - Juniper.junos
- connection: local
- gather_facts: no
- # Execute tasks (plays) this way "ansible-playbook <path>/GET.yml --tags <tag-name>"
- tasks:
- # Check if a device is NETCONF-aware
- - name: CHECK-NETCONF
- tags: check-netconf
- wait_for: host="{{ inventory_hostname }}" port="{{ juniper_port }}"
- ### WEB ### junos-ansible-modules.readthedocs.org/en/1.3.1/
- ### JUNOS_GET_FACTS SECTION
- # Get information about a device (model, active software version, serial number) and show as ansible output
- - name: GET-MODEL
- tags: get-model
- junos_get_facts: host="{{ inventory_hostname }}" user="{{ juniper_user }}" port="{{ juniper_port }}"
- savedir="/opt/juniper/"
- register: junos
- - name: SHOW VARS
- tags: get-model
- debug: msg="MODEL {{ junos.facts.model }} | SOFTWARE {{ junos.facts.version }} | S/N {{ junos.facts.serialnumber }}"
- ### JUNOS_GET_CONFIG SECTION
- # Execute "show configuration system" and save output to a file
- - name: GET-CONFIG-SYSTEM
- tags: get-config-system
- junos_get_config: host="{{ inventory_hostname }}" user="{{ juniper_user }}" port="{{ juniper_port }}"
- format=text
- dest="/opt/juniper/{{ inventory_hostname }}_get-config-system.output"
- filter=system
- ### JUNOS_CLI SECTION
- # Get list of interfaces and save output to a file
- - name: GET-INTERFACES
- tags: get-interfaces
- junos_cli: host="{{ inventory_hostname }}" user="{{ juniper_user }}" port="{{ juniper_port }}"
- dest="/opt/juniper/{{ inventory_hostname }}_get-interfaces.output"
- cli="show interfaces terse"
- ### EOF ###
- I get following error:
- funabashi@vps:/etc/ansible/roles/Juniper.junos/library$ sudo ansible-playbook GET.yml -l fw -u ansible -k -t get-config-system
- SSH password:
- PLAY [GET] ******************************************************************************************************************************************************************************************
- TASK [GET-CONFIG-SYSTEM] ****************************************************************************************************************************************************************************
- fatal: [212.37.x.x]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'juniper_user' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/Juniper.junos/library/GET.yml': line 30, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n # Execute \"show configuration system\" and save output to a file\n - name: GET-CONFIG-SYSTEM\n ^ here\n"}
- to retry, use: --limit @/etc/ansible/roles/Juniper.junos/library/GET.retry
- PLAY RECAP ******************************************************************************************************************************************************************************************
- 212.37.x.x : ok=0 changed=0 unreachable=0 failed=1
- funabashin@vps:/etc/ansible/roles/Juniper.junos/library$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement