Coder Social home page Coder Social logo

ansible-collections / junipernetworks.junos Goto Github PK

View Code? Open in Web Editor NEW
78.0 11.0 61.0 2.29 MB

Ansible Network Collection for Juniper JunOS

License: GNU General Public License v3.0

Python 100.00% Jinja 0.01%
ansible-collection junos-automation

junipernetworks.junos's Introduction

Juniper Networks Junos Collection

CI Codecov CI

The Ansible Juniper Networks Junos collection includes a variety of Ansible content to help automate the management of Juniper Networks Junos network appliances.

This collection has been tested against Juniper Networks Junos OS 18.4R1.

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.15.0.

For collections that support Ansible 2.9, please ensure you update your network_os to use the fully qualified collection name (for example, cisco.ios.ios). Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Supported connections

The Juniper Networks Junos collection supports network_cli and netconf connections.

Included content

Cliconf plugins

Name Description
junipernetworks.junos.junos Use junos cliconf to run command on Juniper Junos OS platform

Netconf plugins

Name Description
junipernetworks.junos.junos Use junos netconf plugin to run netconf commands on Juniper JUNOS platform

Modules

Name Description
junipernetworks.junos.junos_acl_interfaces ACL interfaces resource module
junipernetworks.junos.junos_acls ACLs resource module
junipernetworks.junos.junos_banner Manage multiline banners on Juniper JUNOS devices
junipernetworks.junos.junos_bgp_address_family Manage BGP Address Family attributes of interfaces on Junos devices.
junipernetworks.junos.junos_bgp_global Manages BGP Global configuration on devices running Juniper JUNOS.
junipernetworks.junos.junos_command Run arbitrary commands on an Juniper JUNOS device
junipernetworks.junos.junos_config Manage configuration on devices running Juniper JUNOS
junipernetworks.junos.junos_facts Collect facts from remote devices running Juniper Junos
junipernetworks.junos.junos_hostname Manage Hostname server configuration on Junos devices.
junipernetworks.junos.junos_interfaces Junos Interfaces resource module
junipernetworks.junos.junos_l2_interfaces L2 interfaces resource module
junipernetworks.junos.junos_l3_interfaces L3 interfaces resource module
junipernetworks.junos.junos_lacp Global Link Aggregation Control Protocol (LACP) Junos resource module
junipernetworks.junos.junos_lacp_interfaces LACP interfaces resource module
junipernetworks.junos.junos_lag_interfaces Link Aggregation Juniper JUNOS resource module
junipernetworks.junos.junos_lldp_global LLDP resource module
junipernetworks.junos.junos_lldp_interfaces LLDP interfaces resource module
junipernetworks.junos.junos_logging_global Manage logging configuration on Junos devices.
junipernetworks.junos.junos_netconf Configures the Junos Netconf system service
junipernetworks.junos.junos_ntp_global Manage NTP configuration on Junos devices.
junipernetworks.junos.junos_ospf_interfaces OSPF Interfaces Resource Module.
junipernetworks.junos.junos_ospfv2 OSPFv2 resource module
junipernetworks.junos.junos_ospfv3 OSPFv3 resource module
junipernetworks.junos.junos_package Installs packages on remote devices running Junos
junipernetworks.junos.junos_ping Tests reachability using ping from devices running Juniper JUNOS
junipernetworks.junos.junos_prefix_lists Manage prefix-lists attributes of interfaces on Junos devices.
junipernetworks.junos.junos_routing_instances Manage routing instances on Junos devices.
junipernetworks.junos.junos_routing_options Manage routing-options configuration on Junos devices.
junipernetworks.junos.junos_rpc Runs an arbitrary RPC over NetConf on an Juniper JUNOS device
junipernetworks.junos.junos_scp Transfer files from or to remote devices running Junos
junipernetworks.junos.junos_security_policies Create and manage security policies on Juniper JUNOS devices
junipernetworks.junos.junos_security_policies_global Manage global security policy settings on Juniper JUNOS devices
junipernetworks.junos.junos_security_zones Manage security zones on Juniper JUNOS devices
junipernetworks.junos.junos_snmp_server Manage SNMP server configuration on Junos devices.
junipernetworks.junos.junos_static_routes Static routes resource module
junipernetworks.junos.junos_system Manage the system attributes on Juniper JUNOS devices
junipernetworks.junos.junos_user Manage local user accounts on Juniper JUNOS devices
junipernetworks.junos.junos_vlans VLANs resource module
junipernetworks.junos.junos_vrf Manage the VRF definitions on Juniper JUNOS devices

Click the Content button to see the list of content included in this collection.

Installing this collection

You can install the Juniper Networks Junos collection with the Ansible Galaxy CLI:

ansible-galaxy collection install junipernetworks.junos

You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: junipernetworks.junos

Using this collection

You can call modules by their Fully Qualified Collection Namespace (FQCN), such as junipernetworks.junos.junos_l2_interfaces. The following example task replaces configuration changes in the existing configuration on a Juniper Networks Junos network device, using the FQCN:

---
- name: "Replace provided configuration with device configuration"
  junipernetworks.junos.junos_l2_interfaces:
    config:
      - name: ge-0/0/3
        access:
          vlan: v101
      - name: ge-0/0/4
        trunk:
          allowed_vlans:
            - vlan30
          native_vlan: 50
    state: replaced

See Also:

Contributing to this collection

We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the Juniper Networks Junos collection repository. See Contributing to Ansible-maintained collections for complete details.

You can also join us on:

See the Ansible Community Guide for details on contributing to Ansible.

Code of Conduct

This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.

Release notes

Release notes are available here.

Roadmap

More information

Licensing

GNU General Public License v3.0 or later.

See LICENSE to see the full text.

junipernetworks.junos's People

Contributors

akira6592 avatar andersson007 avatar ansible-zuul[bot] avatar ashwini-mhatre avatar avermeer-tc avatar benjdudas avatar bmillemathias avatar capttrews avatar cidrblock avatar danielmellado avatar dericcrago avatar eb4x avatar elchico2007 avatar ganeshrn avatar gomathiselvis avatar junousi avatar justjais avatar kb-perbyte avatar kjspgd avatar lasseleegaard avatar nilashishc avatar pabelanger avatar pranav-bhatt avatar pre-commit-ci[bot] avatar qalthos avatar raubvogel avatar rohitthakur2590 avatar roverflow avatar samccann avatar torvitas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

junipernetworks.junos's Issues

junos_config does not accept multiple XML elements

SUMMARY

When loading a config file that contain more than one element, the following error is return :
fatal: [NCDIB102]: FAILED! => {"changed": false, "msg": "b'Extra content at the end of the document, line 2, column 8 (, line 2)'"}
It looks like the config content is check to be a valid XML content which cannot be without a root node. The root node is append after the check.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_config

ANSIBLE VERSION
ansible 2.9.10
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION
OS / ENVIRONMENT

JUNOS 20.1R1-S4.1

STEPS TO REPRODUCE
- name: create config file
  copy: 
    content="<snmp><location>tower</location></snmp><system><host-name>NCDIA101</host-name></system>" 
    dest="base.conf"

- name: validate and compare rendered configuration
  junipernetworks.junos.junos_config:
    update: 'merge'
    src: "base.conf"
    src_format: xml
    check_commit: yes
    confirm_commit: no
  diff: true
  register: response
  ignore_errors: true
  vars:
    ansible_network_os: junipernetworks.junos.junos
EXPECTED RESULTS

Candidate datastore should be modified on the router and the config diff returned

ACTUAL RESULTS
TASK [validate and compare rendered configuration] *****************************
task path: /tmp/awx_11063_4ft_uoqe/project/juniper_diff_config.yml:6
<81.253.192.8> attempting to start connection
<81.253.192.8> using connection plugin netconf
<81.253.192.8> found existing local domain socket, using it!
<81.253.192.8> 
<81.253.192.8> local domain socket path is /var/lib/awx/.ansible/pc/02f8f9c6f7
<81.253.192.8> ESTABLISH LOCAL CONNECTION FOR USER: root
<81.253.192.8> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw `"&& mkdir /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121 && echo ansible-tmp-1613671279.3359146-29713-182848987971121="` echo /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121 `" ) && sleep 0'
Using module file /var/lib/awx/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py
<81.253.192.8> PUT /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/tmpz3ajfn8y TO /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121/AnsiballZ_junos_config.py
<81.253.192.8> EXEC /bin/sh -c 'chmod u+x /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121/ /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121/AnsiballZ_junos_config.py && sleep 0'
<81.253.192.8> EXEC /bin/sh -c '/var/lib/awx/venv/ansible/bin/python3.6 /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121/AnsiballZ_junos_config.py && sleep 0'
<81.253.192.8> EXEC /bin/sh -c 'rm -f -r /var/lib/awx/.ansible/tmp/ansible-local-29642zr5knniw/ansible-tmp-1613671279.3359146-29713-182848987971121/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_junipernetworks.junos.junos_config_payload_w0umwlr4/ansible_junipernetworks.junos.junos_config_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py", line 196, in load_configuration
    config=candidate, action=action, format=format
  File "/tmp/ansible_junipernetworks.junos.junos_config_payload_w0umwlr4/ansible_junipernetworks.junos.junos_config_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 81, in __rpc__
    to_bytes(rpc_error, errors="surrogate_then_replace")
  File "/tmp/ansible_junipernetworks.junos.junos_config_payload_w0umwlr4/ansible_junipernetworks.junos.junos_config_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 126, in parse_rpc_error
    raise ConnectionError(rpc_error)
fatal: [NCDIB102]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backup": false,
            "backup_options": null,
            "check_commit": true,
            "comment": "configured by junos_config",
            "confirm": 0,
            "confirm_commit": false,
            "lines": null,
            "provider": null,
            "replace": null,
            "rollback": null,
            "src": "<snmp><location>tower</location></snmp><system><host-name>NCDIA101</host-name></system>",
            "src_format": "xml",
            "update": "merge",
            "zeroize": false
        }
    },
    "msg": "b'Extra content at the end of the document, line 1, column 40 (<string>, line 1)'"
}

junipernetworks.junos.junos_facts throws an error

SUMMARY

I'm trying to get all facts from a juniper switch but the facts module fails to do so.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_facts module

ANSIBLE VERSION
ansible 2.10.3
  config file = /foobar/ansible.cfg
  configured module search path = ['/foo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /foo/.pyvenvs/ansible_networking/lib/python3.8/site-packages/ansible
  executable location = /foo/.pyvenvs/ansible_networking/bin/ansible
  python version = 3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0]
CONFIGURATION
ANSIBLE_NOCOWS(/foobar/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/foobar/ansible.cfg) = -C -o ControlMaster=auto -o ControlPersist=60s
ANSIBLE_SSH_CONTROL_PATH(/foobar/ansible.cfg) = %(directory)s/%%C
ANSIBLE_SSH_CONTROL_PATH_DIR(/foobar/ansible.cfg) = /tmp
COLLECTIONS_PATHS(/foobar/ansible.cfg) = ['/foobar/collections']
DEFAULT_HOST_LIST(/foobar/ansible.cfg) = ['/foobar/inventory']
DEFAULT_REMOTE_PORT(/foobar/ansible.cfg) = 22
DEFAULT_REMOTE_USER(/foobar/ansible.cfg) = ricardo.band
DEFAULT_ROLES_PATH(/foobar/ansible.cfg) = ['/foobar/roles']
DEFAULT_STDOUT_CALLBACK(/foobar/ansible.cfg) = yaml
HOST_KEY_CHECKING(/foobar/ansible.cfg) = False
INTERPRETER_PYTHON(/foobar/ansible.cfg) = /usr/bin/python3
PERSISTENT_COMMAND_TIMEOUT(/foobar/ansible.cfg) = 30
PERSISTENT_CONNECT_RETRY_TIMEOUT(/foobar/ansible.cfg) = 15
PERSISTENT_CONNECT_TIMEOUT(/foobar/ansible.cfg) = 30
OS / ENVIRONMENT
$ uname -a
Linux lucy 5.9.1-arch1-1 #1 SMP PREEMPT Sat, 17 Oct 2020 13:30:37 +0000 x86_64 GNU/Linux
$ python --version
Python 3.8.6

Switch is a QFX5100-24Q-3AFO with firmware 14.1X53-D45.3.

STEPS TO REPRODUCE
---
- hosts: core
  tasks:
    - name: collect default set of facts
      junipernetworks.junos.junos_facts:
        gather_network_resources: all
        gather_subset: all
      register: _devices

    - debug:
        var: _devices
EXPECTED RESULTS

It should give me a pretty big dictionary with all the gathered facts.

ACTUAL RESULTS
ansible-playbook play.yml -v
Using /foobar/ansible.cfg as config file

PLAY [core] *************************************************************

TASK [Gathering Facts] **************************************************
[WARNING]: Ignoring timeout(10) for junipernetworks.junos.junos_facts
ok: [core-01.example.io]

TASK [collect default set of facts] *************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'new_ele' is not defined
fatal: [core-01.example.io]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/foo/.ansible/tmp/ansible-local-775527vaydzqy3/ansible-tmp-1604671561.1315966-775613-110586876082641/AnsiballZ_junos_facts.py", line 102, in <module>
        _ansiballz_main()
      File "/foo/.ansible/tmp/ansible-local-775527vaydzqy3/ansible-tmp-1604671561.1315966-775613-110586876082641/AnsiballZ_junos_facts.py", line 94, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/foo/.ansible/tmp/ansible-local-775527vaydzqy3/ansible-tmp-1604671561.1315966-775613-110586876082641/AnsiballZ_junos_facts.py", line 40, in invoke_module
        runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)
      File "/usr/lib/python3.8/runpy.py", line 207, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_edikinj4/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py", line 147, in <module>
      File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_edikinj4/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py", line 138, in main
      File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_edikinj4/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py", line 114, in get_facts
      File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_edikinj4/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 131, in get_network_resources_facts
      File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_edikinj4/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/interfaces.py", line 74, in populate_facts
      File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_edikinj4/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/utils.py", line 29, in get_resource_config
    NameError: name 'new_ele' is not defined
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

PLAY RECAP **************************************************************
core-01.example.io : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

The name error on "new_ele" sounds like that ether the variable doesn't container the needed XML object to have that function or the "new_element" string got cut off somewhere if this is the full name. Haven't looked at the code level yet.

junos_config: diff module output not displayed correctly

SUMMARY

junos_config: junos playbook not displaying diff output correctly

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_config

ANSIBLE VERSION
ansible 2.9.11
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION
[root@localhost ~]# ansible-config dump --only-changed
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = yaml
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
[root@localhost ~]# ansible-config dump 
ACTION_WARNINGS(default) = True
AGNOSTIC_BECOME_PROMPT(default) = True
ALLOW_WORLD_READABLE_TMPFILES(default) = False
ANSIBLE_CONNECTION_PATH(default) = None
ANSIBLE_COW_PATH(default) = None
ANSIBLE_COW_SELECTION(default) = default
ANSIBLE_COW_WHITELIST(default) = ['bud-frogs', 'bunny', 'cheese', 'daemon', 'de>
ANSIBLE_FORCE_COLOR(default) = False
ANSIBLE_NOCOLOR(default) = False
ANSIBLE_NOCOWS(default) = False
ANSIBLE_PIPELINING(default) = False
ANSIBLE_SSH_ARGS(default) = -C -o ControlMaster=auto -o ControlPersist=60s
ANSIBLE_SSH_CONTROL_PATH(default) = None
ANSIBLE_SSH_CONTROL_PATH_DIR(default) = ~/.ansible/cp
ANSIBLE_SSH_EXECUTABLE(default) = ssh
ANSIBLE_SSH_RETRIES(default) = 0
ANY_ERRORS_FATAL(default) = False
BECOME_ALLOW_SAME_USER(default) = False
BECOME_PLUGIN_PATH(default) = ['/root/.ansible/plugins/become', '/usr/share/ans>
CACHE_PLUGIN(default) = memory
CACHE_PLUGIN_CONNECTION(default) = None
CACHE_PLUGIN_PREFIX(default) = ansible_facts
CACHE_PLUGIN_TIMEOUT(default) = 86400
COLLECTIONS_PATHS(default) = ['/root/.ansible/collections', '/usr/share/ansible>
COLOR_CHANGED(default) = yellow
COLOR_CONSOLE_PROMPT(default) = white
COLOR_DEBUG(default) = dark gray
COLOR_DEPRECATE(default) = purple
COLOR_DIFF_ADD(default) = green
COLOR_DIFF_LINES(default) = cyan
COLOR_DIFF_REMOVE(default) = red
COLOR_ERROR(default) = red
COLOR_HIGHLIGHT(default) = white
COLOR_OK(default) = green
COLOR_SKIP(default) = cyan
COLOR_UNREACHABLE(default) = bright red
COLOR_VERBOSE(default) = blue
COLOR_WARN(default) = bright purple
COMMAND_WARNINGS(default) = True
CONDITIONAL_BARE_VARS(default) = True
CONNECTION_FACTS_MODULES(default) = {'asa': 'asa_facts', 'cisco.asa.asa': 'cisc>
COVERAGE_REMOTE_OUTPUT(default) = None
COVERAGE_REMOTE_WHITELIST(default) = *
DEFAULT_ACTION_PLUGIN_PATH(default) = ['/root/.ansible/plugins/action', '/usr/s>
DEFAULT_ALLOW_UNSAFE_LOOKUPS(default) = False
DEFAULT_ASK_PASS(default) = False
DEFAULT_ASK_VAULT_PASS(default) = False
DEFAULT_BECOME(default) = False
DEFAULT_BECOME_ASK_PASS(default) = False
DEFAULT_BECOME_EXE(default) = None
DEFAULT_BECOME_FLAGS(default) = 
DEFAULT_BECOME_METHOD(default) = sudo
DEFAULT_BECOME_USER(default) = root
DEFAULT_CACHE_PLUGIN_PATH(default) = ['/root/.ansible/plugins/cache', '/usr/sha>
DEFAULT_CALLABLE_WHITELIST(default) = []
DEFAULT_CALLBACK_PLUGIN_PATH(default) = ['/root/.ansible/plugins/callback', '/u>
DEFAULT_CALLBACK_WHITELIST(default) = []
DEFAULT_CLICONF_PLUGIN_PATH(default) = ['/root/.ansible/plugins/cliconf', '/usr>
DEFAULT_CONNECTION_PLUGIN_PATH(default) = ['/root/.ansible/plugins/connection',>
DEFAULT_DEBUG(default) = False
DEFAULT_EXECUTABLE(default) = /bin/sh
DEFAULT_FACT_PATH(default) = None
DEFAULT_FILTER_PLUGIN_PATH(default) = ['/root/.ansible/plugins/filter', '/usr/s>
DEFAULT_FORCE_HANDLERS(default) = False
DEFAULT_FORKS(default) = 5
DEFAULT_GATHERING(default) = implicit
DEFAULT_GATHER_SUBSET(default) = ['all']
DEFAULT_GATHER_TIMEOUT(default) = 10
DEFAULT_HANDLER_INCLUDES_STATIC(default) = False
DEFAULT_HASH_BEHAVIOUR(default) = replace
DEFAULT_HOST_LIST(default) = ['/etc/ansible/hosts']
DEFAULT_HTTPAPI_PLUGIN_PATH(default) = ['/root/.ansible/plugins/httpapi', '/usr>
DEFAULT_INTERNAL_POLL_INTERVAL(default) = 0.001
DEFAULT_INVENTORY_PLUGIN_PATH(default) = ['/root/.ansible/plugins/inventory', '>
DEFAULT_JINJA2_EXTENSIONS(default) = []
DEFAULT_JINJA2_NATIVE(default) = False
DEFAULT_KEEP_REMOTE_FILES(default) = False
DEFAULT_LIBVIRT_LXC_NOSECLABEL(default) = False
DEFAULT_LOAD_CALLBACK_PLUGINS(default) = False
DEFAULT_LOCAL_TMP(default) = /root/.ansible/tmp/ansible-local-386927yy8k8f9
DEFAULT_LOG_FILTER(default) = []
DEFAULT_LOG_PATH(default) = None
DEFAULT_LOOKUP_PLUGIN_PATH(default) = ['/root/.ansible/plugins/lookup', '/usr/s>
DEFAULT_MANAGED_STR(default) = Ansible managed
DEFAULT_MODULE_ARGS(default) = 
DEFAULT_MODULE_COMPRESSION(default) = ZIP_DEFLATED
DEFAULT_MODULE_NAME(default) = command
DEFAULT_MODULE_PATH(default) = ['/root/.ansible/plugins/modules', '/usr/share/a>
DEFAULT_MODULE_UTILS_PATH(default) = ['/root/.ansible/plugins/module_utils', '/>
DEFAULT_NETCONF_PLUGIN_PATH(default) = ['/root/.ansible/plugins/netconf', '/usr>
DEFAULT_NO_LOG(default) = False
DEFAULT_NO_TARGET_SYSLOG(default) = False
DEFAULT_NULL_REPRESENTATION(default) = None
DEFAULT_POLL_INTERVAL(default) = 15
DEFAULT_PRIVATE_KEY_FILE(default) = None
DEFAULT_PRIVATE_ROLE_VARS(default) = False
DEFAULT_REMOTE_PORT(default) = None
DEFAULT_REMOTE_USER(default) = None
DEFAULT_ROLES_PATH(default) = ['/root/.ansible/roles', '/usr/share/ansible/role>
DEFAULT_SCP_IF_SSH(default) = smart
DEFAULT_SELINUX_SPECIAL_FS(default) = ['fuse', 'nfs', 'vboxsf', 'ramfs', '9p', >
DEFAULT_SFTP_BATCH_MODE(default) = True
DEFAULT_SQUASH_ACTIONS(default) = ['apk', 'apt', 'dnf', 'homebrew', 'openbsd_pk>
DEFAULT_SSH_TRANSFER_METHOD(default) = None
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = yaml
DEFAULT_STRATEGY(default) = linear
DEFAULT_STRATEGY_PLUGIN_PATH(default) = ['/root/.ansible/plugins/strategy', '/u>
DEFAULT_SU(default) = False
DEFAULT_SYSLOG_FACILITY(default) = LOG_USER
DEFAULT_TASK_INCLUDES_STATIC(default) = False
DEFAULT_TERMINAL_PLUGIN_PATH(default) = ['/root/.ansible/plugins/terminal', '/u>
DEFAULT_TEST_PLUGIN_PATH(default) = ['/root/.ansible/plugins/test', '/usr/share>
DEFAULT_TIMEOUT(default) = 10
DEFAULT_TRANSPORT(default) = smart
DEFAULT_UNDEFINED_VAR_BEHAVIOR(default) = True
DEFAULT_VARS_PLUGIN_PATH(default) = ['/root/.ansible/plugins/vars', '/usr/share>
DEFAULT_VAULT_ENCRYPT_IDENTITY(default) = None
DEFAULT_VAULT_IDENTITY(default) = default
DEFAULT_VAULT_IDENTITY_LIST(default) = []
DEFAULT_VAULT_ID_MATCH(default) = False
DEFAULT_VAULT_PASSWORD_FILE(default) = None
DEFAULT_VERBOSITY(default) = 0
DEPRECATION_WARNINGS(default) = True
DIFF_ALWAYS(default) = False
DIFF_CONTEXT(default) = 3
DISPLAY_ARGS_TO_STDOUT(default) = False
DISPLAY_SKIPPED_HOSTS(default) = True
DOCSITE_ROOT_URL(default) = https://docs.ansible.com/ansible/
DOC_FRAGMENT_PLUGIN_PATH(default) = ['/root/.ansible/plugins/doc_fragments', '/>
DUPLICATE_YAML_DICT_KEY(default) = warn
ENABLE_TASK_DEBUGGER(default) = False
ERROR_ON_MISSING_HANDLER(default) = True
FACTS_MODULES(default) = ['smart']
GALAXY_IGNORE_CERTS(default) = False
GALAXY_ROLE_SKELETON(default) = None
GALAXY_ROLE_SKELETON_IGNORE(default) = ['^.git$', '^.*/.git_keep$']
GALAXY_SERVER(default) = https://galaxy.ansible.com
GALAXY_SERVER_LIST(default) = None
GALAXY_TOKEN(default) = None
GALAXY_TOKEN_PATH(default) = /root/.ansible/galaxy_token
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
HOST_PATTERN_MISMATCH(default) = warning
INJECT_FACTS_AS_VARS(default) = True
INTERPRETER_PYTHON(default) = auto_legacy
INTERPRETER_PYTHON_DISTRO_MAP(default) = {'centos': {'6': '/usr/bin/python', '8>
INTERPRETER_PYTHON_FALLBACK(default) = ['/usr/bin/python', 'python3.7', 'python>
INVALID_TASK_ATTRIBUTE_FAILED(default) = True
INVENTORY_ANY_UNPARSED_IS_FAILED(default) = False
INVENTORY_CACHE_ENABLED(default) = False
INVENTORY_CACHE_PLUGIN(default) = None
INVENTORY_CACHE_PLUGIN_CONNECTION(default) = None
INVENTORY_CACHE_PLUGIN_PREFIX(default) = ansible_facts
INVENTORY_CACHE_TIMEOUT(default) = 3600
INVENTORY_ENABLED(default) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'to>
INVENTORY_EXPORT(default) = False
INVENTORY_IGNORE_EXTS(default) = {{(BLACKLIST_EXTS + ( '.orig', '.ini', '.cfg',>
INVENTORY_IGNORE_PATTERNS(default) = []
INVENTORY_UNPARSED_IS_FAILED(default) = False
LOCALHOST_WARNING(default) = True
MAX_FILE_SIZE_FOR_DIFF(default) = 104448
NETCONF_SSH_CONFIG(default) = None
NETWORK_GROUP_MODULES(default) = ['eos', 'nxos', 'ios', 'iosxr', 'junos', 'enos>
OLD_PLUGIN_CACHE_CLEARING(default) = False
PARAMIKO_HOST_KEY_AUTO_ADD(default) = False
PARAMIKO_LOOK_FOR_KEYS(default) = True
PERSISTENT_COMMAND_TIMEOUT(default) = 30
PERSISTENT_CONNECT_RETRY_TIMEOUT(default) = 15
PERSISTENT_CONNECT_TIMEOUT(default) = 30
PERSISTENT_CONTROL_PATH_DIR(default) = /root/.ansible/pc
PLAYBOOK_DIR(default) = None
PLAYBOOK_VARS_ROOT(default) = top
PLUGIN_FILTERS_CFG(default) = None
PYTHON_MODULE_RLIMIT_NOFILE(default) = 0
RETRY_FILES_ENABLED(default) = False
RETRY_FILES_SAVE_PATH(default) = None
SHOW_CUSTOM_STATS(default) = False
STRING_CONVERSION_ACTION(default) = warn
STRING_TYPE_FILTERS(default) = ['string', 'to_json', 'to_nice_json', 'to_yaml',>
SYSTEM_WARNINGS(default) = True
TAGS_RUN(default) = []
TAGS_SKIP(default) = []
TASK_DEBUGGER_IGNORE_ERRORS(default) = True
TRANSFORM_INVALID_GROUP_CHARS(default) = never
USE_PERSISTENT_CONNECTIONS(default) = False
VARIABLE_PRECEDENCE(default) = ['all_inventory', 'groups_inventory', 'all_plugi>
VERBOSE_TO_STDERR(default) = False
YAML_FILENAME_EXTENSIONS(default) = ['.yml', '.yaml', '.json']
OS / ENVIRONMENT

OS = Redhat v 8.1

Target OS = 
Hostname: dmz-firewall
Model: vSRX
Junos: 19.2R1-S2.2
JUNOS OS Kernel 64-bit XEN [20191120.0ebd4bf_builder_stable_11]
JUNOS OS libs [20191120.0ebd4bf_builder_stable_11]
JUNOS OS runtime [20191120.0ebd4bf_builder_stable_11]
JUNOS OS time zone information [20191120.0ebd4bf_builder_stable_11]
JUNOS OS libs compat32 [20191120.0ebd4bf_builder_stable_11]
JUNOS OS 32-bit compatibility [20191120.0ebd4bf_builder_stable_11]
JUNOS py extensions [20191121.175308_builder_junos_192_r1_s2]
JUNOS py base [20191121.175308_builder_junos_192_r1_s2]
JUNOS OS vmguest [20191120.0ebd4bf_builder_stable_11]
JUNOS OS support utilities [20191120.0ebd4bf_builder_stable_11]
JUNOS OS crypto [20191120.0ebd4bf_builder_stable_11]
JUNOS network stack and utilities [20191121.175308_builder_junos_192_r1_s2]
JUNOS libs [20191121.175308_builder_junos_192_r1_s2]
JUNOS libs compat32 [20191121.175308_builder_junos_192_r1_s2]
JUNOS runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS na telemetry [19.2R1-S2.2]
JUNOS Web Management Platform Package [20191121.175308_builder_junos_192_r1_s2]
JUNOS vsrx modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx libs compat32 [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx platform support [20191121.175308_builder_junos_192_r1_s2]
JUNOS common platform support [20191121.175308_builder_junos_192_r1_s2]
JUNOS vsrx runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS pppoe [20191121.175308_builder_junos_192_r1_s2]
JUNOS Openconfig [19.2R1-S2.2]
JUNOS mtx network modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx libs [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx Data Plane Crypto Support [20191121.175308_builder_junos_192_r1_s2]
JUNOS daemons [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx daemons [20191121.175308_builder_junos_192_r1_s2]
JUNOS SRX TVP AppQos Daemon [20191121.175308_builder_junos_192_r1_s2]
JUNOS Extension Toolkit [20191121.175308_builder_junos_192_r1_s2]
JUNOS Juniper Malware Removal Tool (JMRT) [1.0.0+20191121.175308_builder_junos_192_r1_s2]
JUNOS J-Insight [20191121.175308_builder_junos_192_r1_s2]
JUNOS Online Documentation [20191121.175308_builder_junos_192_r1_s2]
JUNOS jail runtime [20191120.0ebd4bf_builder_stable_11]
JUNOS FIPS mode utilities [20191121.175308_builder_junos_192_r1_s2]
STEPS TO REPRODUCE
[juniper]
172.16.203.121

[juniper:vars]
ansible_user=****************
ansible_network_os=junipernetworks.junos.junos
ansible_connection=local
ansible_password=*************

---
- name: Juniper SRX configuration compliance checks 
  hosts: juniper
  gather_facts: false
  tasks:
  - set_fact:
         config_directory: '{{ "/home/gefelas/ansible_junos/files/" }}'
  - name: Syslog server check
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/syslog_config.txt'
      src_format: set
      comment: Ensure that appropriate Syslog server configured 
    register: junos_output
    diff: true
  - debug:
       var: junos_output
  - debug:
      msg: Syslog server check - This check has passed with the following output({{ junos_output.diff.prepared }})
    when: not junos_output.changed 
  - debug:
      msg: Syslog server check - This check has failed with the following output({{ junos_output.diff.prepared }})
    when: junos_output.changed 

  - name: Admin credentials check
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/admin_user.txt'
      comment: Ensure that Admin user have been created
    register: junos_output1
    diff: true
  - debug:
       var: junos_output1
  - debug:
      msg: Admin credentials check - This check has passed with the following output({{ junos_output1 }})
    when: not junos_output1.changed 
  - debug:
      msg: Admin credentials check - This check has failed with the following output({{ junos_output1 }})
    when: junos_output1.changed 
 
  - name: NTP Server check 
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/NTP_server.txt'
      comment: Ensure that correct NTP servers has been configured
    diff: true
    register: junos_output2
  - debug:
       var: junos_output2
  - debug:
      msg: NTP Server check  - This check has passed with the following output({{ junos_output2 }})
    when: not junos_output2.changed 
  - debug:
      msg: NTP Server check  - This check has failed with the following output({{ junos_output2 }})
    when: junos_output2.changed 
     
  - name: Idle timeout check 
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/idle_timeout.txt'
      comment: Ensure that idle timeout has been configured
    diff: true
    register: junos_output3
  - debug:
       var: junos_output3
  - debug:
      msg: Idle timeout check   - This check has passed with the following output({{ junos_output3 }})
    when: not junos_output3.changed 
  - debug:
      msg: Idle timeout check   - This check has failed with the following output({{ junos_output3 }})
    when: junos_output3.changed 
EXPECTED RESULTS

The results should be as a result of comparing the src directory against the configuration of juniper vsrx ... The src files are similar to these
https://github.com/gefela/ansible_junos/tree/master/files
However the output is not displayed correctly for the last 3 tasks

ACTUAL RESULTS

When I run this command .

ansible-playbook -i inventory junos_config_new.yml --check -vvv

I get the following error message .

[root@localhost ansible_junos]# ansible-playbook -i inventory junos_config_new.yml -vv --check --diff
ansible-playbook 2.9.11
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file

PLAYBOOK: junos_config_new.yml *****************************************************************************************************************************
1 plays in junos_config_new.yml

PLAY [Juniper SRX configuration compliance checks] *********************************************************************************************************
META: ran handlers

TASK [set_fact] ********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:6
ok: [172.16.203.121] => changed=false 
  ansible_facts:
    config_directory: /home/gefelas/ansible_junos/files/

TASK [Syslog server check] *********************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:8
[edit system syslog host 192.168.100.70]
+     interactive-commands any;
[edit system syslog host 192.168.100.70]
+    facility-override local1;
+    log-prefix firewall;
+    source-address 172.16.203.121;
+    explicit-priority;
[edit system syslog]
+    file messages {
+        any critical;
+        authorization info;
+    }
+    file default-log-messages {
+        structured-data;
+    }
+    file sessions {
+        user info;
+    }
+    file interactive-commands {
+        interactive-commands error;
+    }
[DEPRECATION WARNING]: Param 'provider' is deprecated. See the module docs for more information. This feature will be removed in version 2.14. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
changed: [172.16.203.121] => changed=true 
  ansible_facts:
    discovered_interpreter_python: /usr/libexec/platform-python

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:15
ok: [172.16.203.121] => 
  junos_output:
    ansible_facts:
      discovered_interpreter_python: /usr/libexec/platform-python
    changed: true
    deprecations:
    - msg: Param 'provider' is deprecated. See the module docs for more information
      version: 2.14
    diff:
      prepared: |-
        [edit system syslog host 192.168.100.70]
        +     interactive-commands any;
        [edit system syslog host 192.168.100.70]
        +    facility-override local1;
        +    log-prefix firewall;
        +    source-address 172.16.203.121;
        +    explicit-priority;
        [edit system syslog]
        +    file messages {
        +        any critical;
        +        authorization info;
        +    }
        +    file default-log-messages {
        +        structured-data;
        +    }
        +    file sessions {
        +        user info;
        +    }
        +    file interactive-commands {
        +        interactive-commands error;
        +    }
    failed: false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:17
skipping: [172.16.203.121] => 

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:20
ok: [172.16.203.121] => 
  msg: |-
    Syslog server check - This check has failed with the following output([edit system syslog host 192.168.100.70]
    +     interactive-commands any;
    [edit system syslog host 192.168.100.70]
    +    facility-override local1;
    +    log-prefix firewall;
    +    source-address 172.16.203.121;
    +    explicit-priority;
    [edit system syslog]
    +    file messages {
    +        any critical;
    +        authorization info;
    +    }
    +    file default-log-messages {
    +        structured-data;
    +    }
    +    file sessions {
    +        user info;
    +    }
    +    file interactive-commands {
    +        interactive-commands error;
    +    })

TASK [Admin credentials check] *****************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:24
ok: [172.16.203.121] => changed=false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:30
ok: [172.16.203.121] => 
  junos_output1:
    changed: false
    deprecations:
    - msg: Param 'provider' is deprecated. See the module docs for more information
      version: 2.14
    failed: false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:32
ok: [172.16.203.121] => 
  msg: 'Admin credentials check - This check has passed with the following output({''changed'': False, ''deprecations'': [{''msg'': "Param ''provider'' is deprecated. See the module docs for more information", ''version'': 2.14}], ''failed'': False})'

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:35
skipping: [172.16.203.121] => 

TASK [NTP Server check] ************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:39
ok: [172.16.203.121] => changed=false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:45
ok: [172.16.203.121] => 
  junos_output2:
    changed: false
    deprecations:
    - msg: Param 'provider' is deprecated. See the module docs for more information
      version: 2.14
    failed: false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:47
ok: [172.16.203.121] => 
  msg: 'NTP Server check  - This check has passed with the following output({''changed'': False, ''deprecations'': [{''msg'': "Param ''provider'' is deprecated. See the module docs for more information", ''version'': 2.14}], ''failed'': False})'

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:50
skipping: [172.16.203.121] => 

TASK [Idle timeout check] **********************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:54
ok: [172.16.203.121] => changed=false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:60
ok: [172.16.203.121] => 
  junos_output3:
    changed: false
    deprecations:
    - msg: Param 'provider' is deprecated. See the module docs for more information
      version: 2.14
    failed: false

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:62
ok: [172.16.203.121] => 
  msg: 'Idle timeout check   - This check has passed with the following output({''changed'': False, ''deprecations'': [{''msg'': "Param ''provider'' is deprecated. See the module docs for more information", ''version'': 2.14}], ''failed'': False})'

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:65
skipping: [172.16.203.121] => 
META: ran handlers
META: ran handlers

PLAY RECAP *************************************************************************************************************************************************
172.16.203.121             : ok=13   changed=1    unreachable=0    failed=0    skipped=4    rescued=0    ignored=0   

The task ( NTP Server check , Admin credentials check and Idle timeout check ) are not displaying properly ...

feature request: confirm option in all modules

SUMMARY

Currently each junos module commits changes right away. If playbook executes multiple junos modules in a row, we don't have an option to revert changes at the end of playbook if we are left with undesired configuration. Example below.

Since junos_config module already has 'confirm' feature, would be nice to add it to all other modules. We are using overridden modules with this feature already. Implementation is simple, I can help if get a green light.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

junos_*.py

ADDITIONAL INFORMATION

Playbook example:

- name: Configure Juniper switch
  hosts: junos
  tasks:
    - name: Create vlan configuration
      junos_vlans:
        config: "{{ vlans }}"
        state: replaced
        confirm: 3
    - name: Configure switchport parameteres of L2 interfaces
      junos_l2_interfaces:
        config: "{{ l2_interfaces|junos_l2_interfaces_filter }}"
        state: replaced
        confirm: 3
    - name: Configure general settings of L2 interfaces
      junos_interface:
        aggregate: "{{ l2_interfaces|include_keys(['description', 'enabled', 'mtu']) }}"
        confirm: 3

    - name: Confirm last commit
      junos_config:
        confirm_commit: yes
      changed_when: false

Fix sanity no_log issues

SUMMARY

Add no_log to argument_spec for the following options

ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'authentication_key' in argument_spec could be a secret, though doesn't have `no_log` set found in config
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'authentication_key' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> groups
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'authentication_key' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> groups -> neighbors
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'authentication_key_chain' in argument_spec could be a secret, though doesn't have `no_log` set found in config
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'authentication_key_chain' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> groups
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'authentication_key_chain' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> groups -> neighbors
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'expedited_update_tokens' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> output_queue_priority
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'key_chain' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> bfd_liveness_detection -> authentication
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'key_chain' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> groups -> bfd_liveness_detection -> authentication
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'key_chain' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> groups -> neighbors -> bfd_liveness_detection -> authentication
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'priority_update_tokens' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> output_queue_priority
ERROR: plugins/modules/junos_bgp_global.py:0:0: no-log-needed: Argument 'update_tokens' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> output_queue_priority -> priority_update_tokens
ERROR: plugins/modules/junos_ospf_interfaces.py:0:0: no-log-needed: Argument 'key_value' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> address_family -> processes -> authentication -> md5
ERROR: plugins/modules/junos_ospf_interfaces.py:0:0: no-log-needed: Argument 'simple_password' in argument_spec could be a secret, though doesn't have `no_log` set found in config -> address_family -> processes -> authentication
ERROR: plugins/modules/junos_user.py:0:0: no-log-needed: Argument 'sshkey' in argument_spec could be a secret, though doesn't have `no_log` set
ERROR: plugins/modules/junos_user.py:0:0: no-log-needed: Argument 'sshkey' in argument_spec could be a secret, though doesn't have `no_log` set found in aggregate

Unable to get partial config from SRX

SUMMARY

Trying to get a part of the configuration from a junos device results in a return of the full configuration.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_command

ANSIBLE VERSION
ansible 2.9.6
  config file = /root/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/enviroments/ansible/lib/python3.8/site-packages/ansible
  executable location = /root/enviroments/ansible/bin/ansible
  python version = 3.8.2 (default, Mar 28 2020, 14:42:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
DEFAULT_GATHERING(/root/ansible/ansible.cfg) = explicit
DEFAULT_HOST_LIST(/root/ansible/ansible.cfg) = ['/root/ansible/netbox_inventory.yml']
DEPRECATION_WARNINGS(/root/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/root/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/root/ansible/ansible.cfg) = /root/enviroments/ansible/bin/python
PERSISTENT_COMMAND_TIMEOUT(/root/ansible/ansible.cfg) = 90
PERSISTENT_CONNECT_TIMEOUT(/root/ansible/ansible.cfg) = 90
OS / ENVIRONMENT

Centos 7, using Netbox as inventory.
SRX210 running JUNOS 12.1X46-D35.1

STEPS TO REPRODUCE

Playbook:

---
  - hosts: SRX210
    gather_facts: no
    tasks:
    - name: Get nested configuration
      junipernetworks.junos.junos_command:
        commands: show configuration system syslog
      register: output

With the following group vars:

---
ansible_connection: netconf
ansible_network_os: junos
ansible_user: ansible
EXPECTED RESULTS

Only the syslog part of the configuration hierarchy.

ACTUAL RESULTS

Ansible returns the full configuration.

PLAYBOOK: syslog_check.yml ***********************************************************************************************************************************************************************************************************************************************************************************************
Positional arguments: syslog_check.yml 
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/root/ansible/netbox_inventory.yml',)
forks: 5
1 plays in syslog_check.yml

PLAY [SRX210] *********************************************************************************************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [Get nested configuration] ***************************************************************************************************************************************************************************************************************************************************************************************
task path: /root/ansible/syslog_check.yml:5
<192.168.8.45> attempting to start connection
<192.168.8.45> using connection plugin netconf
<192.168.8.45> local domain socket does not exist, starting it
<192.168.8.45> control socket path is /root/.ansible/pc/e0106bdb55
<192.168.8.45> local domain socket listeners started successfully
<192.168.8.45> loaded netconf plugin junos from path /root/enviroments/ansible/lib/python3.8/site-packages/ansible/plugins/netconf/junos.py for network_os junos
<192.168.8.45> 
<192.168.8.45> local domain socket path is /root/.ansible/pc/e0106bdb55
<192.168.8.45> ESTABLISH LOCAL CONNECTION FOR USER: root
<192.168.8.45> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951 `" && echo ansible-tmp-1603282544.7955146-83583177207951="` echo /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py
<192.168.8.45> PUT /root/.ansible/tmp/ansible-local-2085dzzlmm9k/tmpv_6_k7r_ TO /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951/AnsiballZ_junos_command.py
<192.168.8.45> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951/ /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951/AnsiballZ_junos_command.py && sleep 0'
<192.168.8.45> EXEC /bin/sh -c '/root/enviroments/ansible/bin/python /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951/AnsiballZ_junos_command.py && sleep 0'
<192.168.8.45> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-2085dzzlmm9k/ansible-tmp-1603282544.7955146-83583177207951/ > /dev/null 2>&1 && sleep 0'
ok: [SRX210] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "show configuration system syslog"
            ],
            "display": null,
            "interval": 1,
            "match": "all",
            "provider": null,
            "retries": 10,
            "rpcs": null,
            "wait_for": null
        }
    },
    "stdout": [
...........

junos_config: Fails with FileNotFoundError

SUMMARY

junos_config: junos playbook fails with FileNotFoundError

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_config

ANSIBLE VERSION
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.local/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
CONFIGURATION
ACTION_WARNINGS(default) = True
AGNOSTIC_BECOME_PROMPT(default) = True
ALLOW_WORLD_READABLE_TMPFILES(default) = False
ANSIBLE_CONNECTION_PATH(default) = None
ANSIBLE_COW_PATH(default) = None
ANSIBLE_COW_SELECTION(default) = default
ANSIBLE_COW_WHITELIST(default) = ['bud-frogs', 'bunny', 'cheese', 'daemon', 'default', 'dragon', 'elephant-in-snake',>
ANSIBLE_FORCE_COLOR(default) = False
ANSIBLE_NOCOLOR(default) = False
ANSIBLE_NOCOWS(default) = False
ANSIBLE_PIPELINING(default) = False
ANSIBLE_SSH_ARGS(default) = -C -o ControlMaster=auto -o ControlPersist=60s
ANSIBLE_SSH_CONTROL_PATH(default) = None
ANSIBLE_SSH_CONTROL_PATH_DIR(default) = ~/.ansible/cp
ANSIBLE_SSH_EXECUTABLE(default) = ssh
ANSIBLE_SSH_RETRIES(default) = 0
ANY_ERRORS_FATAL(default) = False
BECOME_ALLOW_SAME_USER(default) = False
BECOME_PLUGIN_PATH(default) = ['/root/.ansible/plugins/become', '/usr/share/ansible/plugins/become']
CACHE_PLUGIN(default) = memory
CACHE_PLUGIN_CONNECTION(default) = None
CACHE_PLUGIN_PREFIX(default) = ansible_facts
CACHE_PLUGIN_TIMEOUT(default) = 86400
COLLECTIONS_PATHS(default) = ['/root/.ansible/collections', '/usr/share/ansible/collections']
COLOR_CHANGED(default) = yellow
COLOR_CONSOLE_PROMPT(default) = white
COLOR_DEBUG(default) = dark gray
COLOR_DEPRECATE(default) = purple
COLOR_DIFF_ADD(default) = green
COLOR_DIFF_LINES(default) = cyan
COLOR_DIFF_REMOVE(default) = red
COLOR_ERROR(default) = red
COLOR_HIGHLIGHT(default) = white
COLOR_OK(default) = green
COLOR_SKIP(default) = cyan
COLOR_UNREACHABLE(default) = bright red
COLOR_VERBOSE(default) = blue
COLOR_WARN(default) = bright purple
COMMAND_WARNINGS(default) = True
CONDITIONAL_BARE_VARS(default) = True
CONNECTION_FACTS_MODULES(default) = {'eos': 'eos_facts', 'frr': 'frr_facts', 'ios': 'ios_facts', 'iosxr': 'iosxr_fact>
COVERAGE_REMOTE_OUTPUT(default) = None
COVERAGE_REMOTE_WHITELIST(default) = *
DEFAULT_ACTION_PLUGIN_PATH(default) = ['/root/.ansible/plugins/action', '/usr/share/ansible/plugins/action']
DEFAULT_ALLOW_UNSAFE_LOOKUPS(default) = False
DEFAULT_ASK_PASS(default) = False
DEFAULT_ASK_VAULT_PASS(default) = False
DEFAULT_BECOME(default) = False
DEFAULT_BECOME_ASK_PASS(default) = False
DEFAULT_BECOME_EXE(default) = None
DEFAULT_BECOME_FLAGS(default) = 
DEFAULT_BECOME_METHOD(default) = sudo
DEFAULT_BECOME_USER(default) = root
DEFAULT_CACHE_PLUGIN_PATH(default) = ['/root/.ansible/plugins/cache', '/usr/share/ansible/plugins/cache']
DEFAULT_CALLABLE_WHITELIST(default) = []
DEFAULT_CALLBACK_PLUGIN_PATH(default) = ['/root/.ansible/plugins/callback', '/usr/share/ansible/plugins/callback']
DEFAULT_CALLBACK_WHITELIST(default) = []
DEFAULT_CLICONF_PLUGIN_PATH(default) = ['/root/.ansible/plugins/cliconf', '/usr/share/ansible/plugins/cliconf']
DEFAULT_CONNECTION_PLUGIN_PATH(default) = ['/root/.ansible/plugins/connection', '/usr/share/ansible/plugins/connectio>
DEFAULT_DEBUG(default) = False
DEFAULT_EXECUTABLE(default) = /bin/sh
DEFAULT_FACT_PATH(default) = None
DEFAULT_FILTER_PLUGIN_PATH(default) = ['/root/.ansible/plugins/filter', '/usr/share/ansible/plugins/filter']
DEFAULT_FORCE_HANDLERS(default) = False
DEFAULT_FORKS(default) = 5
DEFAULT_GATHERING(default) = implicit
DEFAULT_GATHER_SUBSET(default) = ['all']
DEFAULT_GATHER_TIMEOUT(default) = 10
DEFAULT_HANDLER_INCLUDES_STATIC(default) = False
DEFAULT_HASH_BEHAVIOUR(default) = replace
DEFAULT_HOST_LIST(default) = ['/etc/ansible/hosts']
DEFAULT_HTTPAPI_PLUGIN_PATH(default) = ['/root/.ansible/plugins/httpapi', '/usr/share/ansible/plugins/httpapi']
DEFAULT_INTERNAL_POLL_INTERVAL(default) = 0.001
DEFAULT_INVENTORY_PLUGIN_PATH(default) = ['/root/.ansible/plugins/inventory', '/usr/share/ansible/plugins/inventory']
DEFAULT_JINJA2_EXTENSIONS(default) = []
DEFAULT_JINJA2_NATIVE(default) = False
DEFAULT_KEEP_REMOTE_FILES(default) = False
DEFAULT_LIBVIRT_LXC_NOSECLABEL(default) = False
DEFAULT_LOAD_CALLBACK_PLUGINS(default) = False
DEFAULT_LOCAL_TMP(default) = /root/.ansible/tmp/ansible-local-981k6lh2qkt
DEFAULT_LOG_FILTER(default) = []
DEFAULT_LOG_PATH(default) = None
DEFAULT_LOOKUP_PLUGIN_PATH(default) = ['/root/.ansible/plugins/lookup', '/usr/share/ansible/plugins/lookup']
DEFAULT_MANAGED_STR(default) = Ansible managed
DEFAULT_MODULE_ARGS(default) = 
DEFAULT_MODULE_COMPRESSION(default) = ZIP_DEFLATED
DEFAULT_MODULE_NAME(default) = command
DEFAULT_MODULE_PATH(default) = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
DEFAULT_MODULE_UTILS_PATH(default) = ['/root/.ansible/plugins/module_utils', '/usr/share/ansible/plugins/module_utils>
DEFAULT_NETCONF_PLUGIN_PATH(default) = ['/root/.ansible/plugins/netconf', '/usr/share/ansible/plugins/netconf']
DEFAULT_NO_LOG(default) = False
DEFAULT_NO_TARGET_SYSLOG(default) = False
DEFAULT_NULL_REPRESENTATION(default) = None
DEFAULT_POLL_INTERVAL(default) = 15
DEFAULT_PRIVATE_KEY_FILE(default) = None
DEFAULT_PRIVATE_ROLE_VARS(default) = False
DEFAULT_REMOTE_PORT(default) = None
DEFAULT_REMOTE_USER(default) = None
DEFAULT_ROLES_PATH(default) = ['/root/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
DEFAULT_SCP_IF_SSH(default) = smart
DEFAULT_SELINUX_SPECIAL_FS(default) = ['fuse', 'nfs', 'vboxsf', 'ramfs', '9p', 'vfat']
DEFAULT_SFTP_BATCH_MODE(default) = True
DEFAULT_SQUASH_ACTIONS(default) = ['apk', 'apt', 'dnf', 'homebrew', 'openbsd_pkg', 'pacman', 'pip', 'pkgng', 'yum', '>
DEFAULT_SSH_TRANSFER_METHOD(default) = None
DEFAULT_STDOUT_CALLBACK(default) = default
DEFAULT_STRATEGY(default) = linear
DEFAULT_STRATEGY_PLUGIN_PATH(default) = ['/root/.ansible/plugins/strategy', '/usr/share/ansible/plugins/strategy']
DEFAULT_SU(default) = False
DEFAULT_SYSLOG_FACILITY(default) = LOG_USER
DEFAULT_TASK_INCLUDES_STATIC(default) = False
DEFAULT_TERMINAL_PLUGIN_PATH(default) = ['/root/.ansible/plugins/terminal', '/usr/share/ansible/plugins/terminal']
DEFAULT_TEST_PLUGIN_PATH(default) = ['/root/.ansible/plugins/test', '/usr/share/ansible/plugins/test']
DEFAULT_TIMEOUT(default) = 10
DEFAULT_TRANSPORT(default) = smart
DEFAULT_UNDEFINED_VAR_BEHAVIOR(default) = True
DEFAULT_VARS_PLUGIN_PATH(default) = ['/root/.ansible/plugins/vars', '/usr/share/ansible/plugins/vars']
DEFAULT_VAULT_ENCRYPT_IDENTITY(default) = None
DEFAULT_VAULT_IDENTITY(default) = default
DEFAULT_VAULT_IDENTITY_LIST(default) = []
DEFAULT_VAULT_ID_MATCH(default) = False
DEFAULT_VAULT_PASSWORD_FILE(default) = None
DEFAULT_VERBOSITY(default) = 0
DEPRECATION_WARNINGS(default) = True
DIFF_ALWAYS(default) = False
DIFF_CONTEXT(default) = 3
DISPLAY_ARGS_TO_STDOUT(default) = False
DISPLAY_SKIPPED_HOSTS(default) = True
DOCSITE_ROOT_URL(default) = https://docs.ansible.com/ansible/
DOC_FRAGMENT_PLUGIN_PATH(default) = ['/root/.ansible/plugins/doc_fragments', '/usr/share/ansible/plugins/doc_fragment>
DUPLICATE_YAML_DICT_KEY(default) = warn
ENABLE_TASK_DEBUGGER(default) = False
ERROR_ON_MISSING_HANDLER(default) = True
FACTS_MODULES(default) = ['smart']
GALAXY_IGNORE_CERTS(default) = False
GALAXY_ROLE_SKELETON(default) = None
GALAXY_ROLE_SKELETON_IGNORE(default) = ['^.git$', '^.*/.git_keep$']
GALAXY_SERVER(default) = https://galaxy.ansible.com
GALAXY_SERVER_LIST(default) = None
GALAXY_TOKEN(default) = None
GALAXY_TOKEN_PATH(default) = /root/.ansible/galaxy_token
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
HOST_PATTERN_MISMATCH(default) = warning
INJECT_FACTS_AS_VARS(default) = True
INTERPRETER_PYTHON(default) = auto_legacy
INTERPRETER_PYTHON_DISTRO_MAP(default) = {'centos': {'6': '/usr/bin/python', '8': '/usr/libexec/platform-python'}, 'f>
INTERPRETER_PYTHON_FALLBACK(default) = ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'pytho>
INVALID_TASK_ATTRIBUTE_FAILED(default) = True
INVENTORY_ANY_UNPARSED_IS_FAILED(default) = False
INVENTORY_CACHE_ENABLED(default) = False
INVENTORY_CACHE_PLUGIN(default) = None
INVENTORY_CACHE_PLUGIN_CONNECTION(default) = None
INVENTORY_CACHE_PLUGIN_PREFIX(default) = ansible_facts
INVENTORY_CACHE_TIMEOUT(default) = 3600
INVENTORY_ENABLED(default) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml']
INVENTORY_EXPORT(default) = False
INVENTORY_IGNORE_EXTS(default) = {{(BLACKLIST_EXTS + ( '.orig', '.ini', '.cfg', '.retry'))}}
INVENTORY_IGNORE_PATTERNS(default) = []
INVENTORY_UNPARSED_IS_FAILED(default) = False
LOCALHOST_WARNING(default) = True
MAX_FILE_SIZE_FOR_DIFF(default) = 104448
NETCONF_SSH_CONFIG(default) = None
NETWORK_GROUP_MODULES(default) = ['eos', 'nxos', 'ios', 'iosxr', 'junos', 'enos', 'ce', 'vyos', 'sros', 'dellos9', 'd>
OLD_PLUGIN_CACHE_CLEARING(default) = False
PARAMIKO_HOST_KEY_AUTO_ADD(default) = False
PARAMIKO_LOOK_FOR_KEYS(default) = True
PERSISTENT_COMMAND_TIMEOUT(default) = 30
PERSISTENT_CONNECT_RETRY_TIMEOUT(default) = 15
PERSISTENT_CONNECT_TIMEOUT(default) = 30
PERSISTENT_CONTROL_PATH_DIR(default) = /root/.ansible/pc
PLAYBOOK_DIR(default) = None
PLAYBOOK_VARS_ROOT(default) = top
PLUGIN_FILTERS_CFG(default) = None
PYTHON_MODULE_RLIMIT_NOFILE(default) = 0
RETRY_FILES_ENABLED(default) = False
RETRY_FILES_SAVE_PATH(default) = None
SHOW_CUSTOM_STATS(default) = False
STRING_CONVERSION_ACTION(default) = warn
STRING_TYPE_FILTERS(default) = ['string', 'to_json', 'to_nice_json', 'to_yaml', 'ppretty', 'json']
SYSTEM_WARNINGS(default) = True
TAGS_RUN(default) = []
TAGS_SKIP(default) = []
TASK_DEBUGGER_IGNORE_ERRORS(default) = True
TRANSFORM_INVALID_GROUP_CHARS(default) = never
USE_PERSISTENT_CONNECTIONS(default) = False
VARIABLE_PRECEDENCE(default) = ['all_inventory', 'groups_inventory', 'all_plugins_inventory', 'all_plugins_play', 'gr>
VERBOSE_TO_STDERR(default) = False
YAML_FILENAME_EXTENSIONS(default) = ['.yml', '.yaml', '.json']
OS / ENVIRONMENT
OS = Redhat v 8.1

Target OS = 
Hostname: dmz-firewall
Model: vSRX
Junos: 19.2R1-S2.2
JUNOS OS Kernel 64-bit XEN [20191120.0ebd4bf_builder_stable_11]
JUNOS OS libs [20191120.0ebd4bf_builder_stable_11]
JUNOS OS runtime [20191120.0ebd4bf_builder_stable_11]
JUNOS OS time zone information [20191120.0ebd4bf_builder_stable_11]
JUNOS OS libs compat32 [20191120.0ebd4bf_builder_stable_11]
JUNOS OS 32-bit compatibility [20191120.0ebd4bf_builder_stable_11]
JUNOS py extensions [20191121.175308_builder_junos_192_r1_s2]
JUNOS py base [20191121.175308_builder_junos_192_r1_s2]
JUNOS OS vmguest [20191120.0ebd4bf_builder_stable_11]
JUNOS OS support utilities [20191120.0ebd4bf_builder_stable_11]
JUNOS OS crypto [20191120.0ebd4bf_builder_stable_11]
JUNOS network stack and utilities [20191121.175308_builder_junos_192_r1_s2]
JUNOS libs [20191121.175308_builder_junos_192_r1_s2]
JUNOS libs compat32 [20191121.175308_builder_junos_192_r1_s2]
JUNOS runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS na telemetry [19.2R1-S2.2]
JUNOS Web Management Platform Package [20191121.175308_builder_junos_192_r1_s2]
JUNOS vsrx modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx libs compat32 [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx platform support [20191121.175308_builder_junos_192_r1_s2]
JUNOS common platform support [20191121.175308_builder_junos_192_r1_s2]
JUNOS vsrx runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS pppoe [20191121.175308_builder_junos_192_r1_s2]
JUNOS Openconfig [19.2R1-S2.2]
JUNOS mtx network modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx libs [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx Data Plane Crypto Support [20191121.175308_builder_junos_192_r1_s2]
JUNOS daemons [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx daemons [20191121.175308_builder_junos_192_r1_s2]
JUNOS SRX TVP AppQos Daemon [20191121.175308_builder_junos_192_r1_s2]
JUNOS Extension Toolkit [20191121.175308_builder_junos_192_r1_s2]
JUNOS Juniper Malware Removal Tool (JMRT) [1.0.0+20191121.175308_builder_junos_192_r1_s2]
JUNOS J-Insight [20191121.175308_builder_junos_192_r1_s2]
JUNOS Online Documentation [20191121.175308_builder_junos_192_r1_s2]
JUNOS jail runtime [20191120.0ebd4bf_builder_stable_11]
JUNOS FIPS mode utilities [20191121.175308_builder_junos_192_r1_s2]
STEPS TO REPRODUCE
[juniper]
172.16.203.121

[juniper:vars]
ansible_user=root
ansible_network_os=junos
ansible_connection=netconf
ansible_ssh_private_key_file=~/.ssh/id_rsa
#ansible_become_method=enable
#ansible_become_password=Redhat123
- name: Juniper SRX configuration compliance checks 
  hosts: juniper
  gather_facts: false
  connection: local
  tasks:
  - set_fact:   
      config_directory: '{{ "/home/gefela/ansible_junos/files" | expanduser }}'
  - name: Syslog server check
    junos_config:
      src: '{{ config_directory }}/syslog_config.txt'
      comment: Ensure that appropriate Syslog server configured 
    register: junos_output
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: Syslog server check - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: Syslog server check - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
  
    
  - name: Admin credentials check
    junos_config:
      src: '{{ config_directory }}/admin_user.txt'
      comment: Ensure that Admin user havee been created
    register: junos_output
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: Admin credentials check - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: Admin credentials check - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
      
    
  - name: NTP Server check 
    junos_config:
      src: '{{ config_directory }}/NTP_server.txt'
      comment: Ensure that correct NTP servers has been configured
    register: junos_output
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: NTP Server check  - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: NTP Server check  - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
      
      
  - name: Idle timeout check 
    junos_config:
      src: '{{ config_directory }}/idle_timeout.txt'
      comment: Ensure that idle timeout has been configured 
    register: junos_output
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: Idle timeout check   - This check has passed with the following output({{ junos_output
}})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: Idle timeout check   - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
EXPECTED RESULTS

The results should be as a resultof comparing the src directory against the configuration of juniper vsrx ... The src files are similar to these
https://github.com/gefela/ansible_junos/tree/master/files

ACTUAL RESULTS

When I run this command .

ansible-playbook -i inventory junos_config_new.yml --check -vvv

I get the following error message .

ansible-playbook 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.local/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /home/gefela/ansible_junos/inventory as it did not pass its verify_file() method
script declined parsing /home/gefela/ansible_junos/inventory as it did not pass its verify_file() method
auto declined parsing /home/gefela/ansible_junos/inventory as it did not pass its verify_file() method
Parsed /home/gefela/ansible_junos/inventory inventory source with ini plugin

PLAYBOOK: junos_config_new.yml ***************************************************************************************
1 plays in junos_config_new.yml

PLAY [Juniper SRX configuration compliance checks] *******************************************************************
META: ran handlers

TASK [set_fact] ******************************************************************************************************
task path: /home/gefela/ansible_junos/junos_config_new.yml:8
ok: [172.16.203.121] => {
    "ansible_facts": {
        "config_directory": "/home/gefela/ansible_junos/files"
    },
    "changed": false
}

TASK [Syslog server check] *******************************************************************************************
task path: /home/gefela/ansible_junos/junos_config_new.yml:10
<172.16.203.121> ESTABLISH LOCAL CONNECTION FOR USER: gefela
<172.16.203.121> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-2031lj2s5zgq `"&& mkdir /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335 && echo ansible-tmp-1590843912.4412684-2055-226301185204335="` echo /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335 `" ) && sleep 0'
<172.16.203.121> Attempting python interpreter discovery
<172.16.203.121> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<172.16.203.121> Python interpreter discovery fallback (pipelining support required for extended interpreter discovery)
Using module file /root/.local/lib/python3.6/site-packages/ansible/modules/network/junos/junos_config.py
<172.16.203.121> PUT /root/.ansible/tmp/ansible-local-2031lj2s5zgq/tmp18j_fyh_ TO /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335/AnsiballZ_junos_config.py
<172.16.203.121> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335/ /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/usr/bin/python3.6 /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-2031lj2s5zgq/ansible-tmp-1590843912.4412684-2055-226301185204335/ > /dev/null 2>&1 && sleep 0'
[WARNING]: Platform linux on host 172.16.203.121 is using the discovered Python interpreter at /usr/bin/python3.6,
but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
fatal: [172.16.203.121]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.6"
    },
    "changed": false,
    "module_stderr": "",
    "module_stdout": "\n{\"msg\": \"FileNotFoundError(2, 'No such file or directory')\", \"failed\": true, \"exception\": \"  File \\\"/tmp/ansible_junos_config_payload_v5kb_re0/ansible_junos_config_payload.zip/ansible/module_utils/network/junos/junos.py\\\", line 97, in get_capabilities\\n    capabilities = Connection(module._socket_path).get_capabilities()\\n  File \\\"/tmp/ansible_junos_config_payload_v5kb_re0/ansible_junos_config_payload.zip/ansible/module_utils/connection.py\\\", line 185, in __rpc__\\n    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)\\n\", \"invocation\": {\"module_args\": {\"src\": \"set system syslog archive size 300000\\nset system syslog archive files 3\\nset system syslog archive world-readable\\nset system syslog user * any emergency\\nset system syslog host 192.168.100.70 any any\\nset system syslog host 192.168.100.70 interactive-commands any\\nset system syslog host 192.168.100.70 facility-override local1\\nset system syslog host 192.168.100.70 log-prefix firewall\\nset system syslog host 192.168.100.70 source-address \\\"172.16.203.121\\\"\\nset system syslog host 192.168.100.70 explicit-priority\\nset system syslog file messages any critical\\nset system syslog file messages authorization info\\nset system syslog file default-log-messages structured-data\\nset system syslog file sessions user info\\nset system syslog file interactive-commands interactive-commands error\\n\", \"comment\": \"Ensure that appropriate Syslog server configured\", \"update\": \"merge\", \"confirm\": 0, \"confirm_commit\": false, \"check_commit\": false, \"backup\": false, \"zeroize\": false, \"lines\": null, \"src_format\": null, \"replace\": null, \"backup_options\": null, \"rollback\": null, \"provider\": null, \"host\": null, \"port\": null, \"username\": null, \"password\": null, \"ssh_keyfile\": null, \"timeout\": null, \"transport\": null}}}\n\n{\"msg\": \"FileNotFoundError(2, 'No such file or directory')\", \"failed\": true, \"exception\": \"  File \\\"/tmp/ansible_junos_config_payload_v5kb_re0/ansible_junos_config_payload.zip/ansible/module_utils/network/junos/junos.py\\\", line 97, in get_capabilities\\n    capabilities = Connection(module._socket_path).get_capabilities()\\n  File \\\"/tmp/ansible_junos_config_payload_v5kb_re0/ansible_junos_config_payload.zip/ansible/module_utils/connection.py\\\", line 185, in __rpc__\\n    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)\\n\", \"invocation\": {\"module_args\": {\"src\": \"set system syslog archive size 300000\\nset system syslog archive files 3\\nset system syslog archive world-readable\\nset system syslog user * any emergency\\nset system syslog host 192.168.100.70 any any\\nset system syslog host 192.168.100.70 interactive-commands any\\nset system syslog host 192.168.100.70 facility-override local1\\nset system syslog host 192.168.100.70 log-prefix firewall\\nset system syslog host 192.168.100.70 source-address \\\"172.16.203.121\\\"\\nset system syslog host 192.168.100.70 explicit-priority\\nset system syslog file messages any critical\\nset system syslog file messages authorization info\\nset system syslog file default-log-messages structured-data\\nset system syslog file sessions user info\\nset system syslog file interactive-commands interactive-commands error\\n\", \"comment\": \"Ensure that appropriate Syslog server configured\", \"update\": \"merge\", \"confirm\": 0, \"confirm_commit\": false, \"check_commit\": false, \"backup\": false, \"zeroize\": false, \"lines\": null, \"src_format\": null, \"replace\": null, \"backup_options\": null, \"rollback\": null, \"provider\": null, \"host\": null, \"port\": null, \"username\": null, \"password\": null, \"ssh_keyfile\": null, \"timeout\": null, \"transport\": null}}}\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

PLAY RECAP ***********************************************************************************************************
172.16.203.121             : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

comma in a string wrongly acting as a separator

SUMMARY

When a parameter in a module is defined as a dictionary and a single string is passed to it, it divides the string based on comma as separate elements.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_config

ANSIBLE VERSION
ansible 2.6.13
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr  2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
DEFAULT_JINJA2_EXTENSIONS(/etc/ansible/ansible.cfg) = jinja2.ext.loopcontrols, jinja2.ext.do
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /var/log/contrail/config-device-manager/contrail-fabric-ansible-playbooks.log
DEFAULT_LOOKUP_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/lookup_plugins']
DEFAULT_MODULE_UTILS_PATH(/etc/ansible/ansible.cfg) = [u'/etc/module_utils']
DEFAULT_VERBOSITY(/etc/ansible/ansible.cfg) = 0
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Linux node1 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Python 2.7.5

Target witch: qfx-5100-48s

STEPS TO REPRODUCE
tasks:
  - name: set config
    junipernetworks.junos.junos_config:
      lines: 'set system login message "IT IS, WRONG"'
EXPECTED RESULTS

The config should have been successfully pushed with the entire string "IT IS, WRONG" set as the login message on the device.

ok: [localhost] => {
    "changed": false, 
    "invocation": {
        "module_args": {
            ...
            "lines": [
                "set system login message \"IT IS, WRONG\""
            ], 
            ...
        }
    }, 
    "msg": "Configuration has been: opened, loaded, checked, diffed, closed."
}
ACTUAL RESULTS
fatal: [localhost]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            ...
            "lines": [
                "set system login message \"IT IS", 
                " WRONG\""
            ], 
           ...
        }
    }, 
    "msg": "Failure loading the configuraton: ConfigLoadError(severity: error, bad_element: WRONG, message: error: unknown command)"
}

Inclusion of junipernetworks.junos in Ansible 2.10

This collection will be included in Ansible 2.10 because it contains modules and/or plugins that were included in Ansible 2.9. Please review:

DEADLINE: 2020-08-18

The latest version of the collection available on August 18 will be included in Ansible 2.10.0, except possibly newer versions which differ only in the patch level. (For details, see the roadmap). Please release version 1.0.0 of your collection by this date! If 1.0.0 does not exist, the same 0.x.y version will be used in all of Ansible 2.10 without updates, and your 1.x.y release will not be included until Ansible 2.11 (unless you request an exception at a community working group meeting and go through a demanding manual process to vouch for backwards compatibility . . . you want to avoid this!).

Follow semantic versioning rules

Your collection versioning must follow all semver rules. This means:

  • Patch level releases can only contain bugfixes;
  • Minor releases can contain new features, new modules and plugins, and bugfixes, but must not break backwards compatibility;
  • Major releases can break backwards compatibility.

Changelogs and Porting Guide

Your collection should provide data for the Ansible 2.10 changelog and porting guide. The changelog and porting guide are automatically generated from ansible-base, and from the changelogs of the included collections. All changes from the breaking_changes, major_changes, removed_features and deprecated_features sections will appear in both the changelog and the porting guide. You have two options for providing changelog fragments to include:

  1. If possible, use the antsibull-changelog tool, which uses the same changelog fragment as the ansible/ansible repository (see the documentation).
  2. If you cannot use antsibull-changelog, you can provide the changelog in a machine-readable format as changelogs/changelog.yaml inside your collection (see the documentation of changelogs/changelog.yaml format).

If you cannot contribute to the integrated Ansible changelog using one of these methods, please provide a link to your collection's changelog by creating an issue in https://github.com/ansible-community/ansible-build-data/. If you do not provide changelogs/changelog.yml or a link, users will not be able to find out what changed in your collection from the Ansible changelog and porting guide.

Make sure your collection passes the sanity tests

Run ansible-test sanity --docker -v in the collection with the latest ansible-base or stable-2.10 ansible/ansible checkout.

Keep informed

Be sure you're subscribed to:

Questions and Feedback

If you have questions or want to provide feedback, please see the Feedback section in the collection requirements.

(Internal link to keep track of issues: ansible-collections/overview#102)

Private argument spec validation methods no longer available in Ansible Core 2.11

SUMMARY

Argument spec validation has changed in Ansible Core 2.11. The following private calls should be changed to use the public interface:

collections/junipernetworks.junos/plugins/modules/junos_user.py
330:        type_checker = module._CHECK_ARGUMENT_TYPES_DISPATCHER[value_type]  # --> ansible.module_utils.common.parameters.DEFAULT_TYPE_VALIDATORS

collections/junipernetworks.junos/plugins/modules/junos_logging.py
309:        module._check_required_if(required_if, param)  # --> ansible.module_utils.common.validation.check_required_if()
ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos/plugins/modules/junos_user.py
junipernetworks.junos/plugins/modules/junos_logging.py

ANSIBLE VERSION
2.11

Add available_network_resources key in junos_facts module

  • The key will return the list of all the RM resources available for the platform.
  • This implementation doesn't affect the current functionality of the junos_facts module and users can use the junos_facts module in the same way as they were before.

Current behavior:

---
- name: Fatch facts
  hosts: junos
  gather_facts: no
  collections:
    - junipernetworks.junos
  
  tasks:
    - name: Get basic facts 
      junos_facts:
        gather_subset:
          - '!all'

output

ok: [192.168.1.63] => {
    "ansible_facts": {
        "ansible_net_api": "netconf",
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default"
        ],
        "ansible_net_hostname": "vsrx",
        "ansible_net_model": "vSRX",
        "ansible_net_python_version": "3.9.2",
        "ansible_net_serialnum": "4a",
        "ansible_net_system": "junos",
        "ansible_net_version": "18.4R1-S3.1",
        "ansible_network_resources": {},
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "available_network_resources": false,
            "config_format": "text",
            "gather_network_resources": null,
            "gather_subset": [
                "!all"
            ],
            "provider": null
        }
    }
}

After implementation of available_network_resources
Sample Playbook:

---
- name: Get the list of  available resource Modules
  hosts: junos
  gather_facts: no
  collections:
    - junipernetworks.junos
  
  tasks:
    - name: Get list of avaliable network resources for Junos vSRX and avoid fetching resource facts
      junos_facts:
        gather_subset:
          - '!all'
        available_network_resources: true

Result:

ok: [192.168.1.63] => {
    "ansible_facts": {
        "ansible_net_api": "netconf",
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default"
        ],
        "ansible_net_hostname": "vsrx",
        "ansible_net_model": "vSRX",
        "ansible_net_python_version": "3.9.2",
        "ansible_net_serialnum": "4agc",
        "ansible_net_system": "junos",
        "ansible_net_version": "18.4R1-S3.1",
        "ansible_network_resources": {},
        "available_network_resources": [
            "acl_interfaces",
            "acls",
            "bgp_address_family",
            "bgp_global",
            "interfaces",
            "l2_interfaces",
            "l3_interfaces",
            "lacp",
            "lacp_interfaces",
            "lag_interfaces",
            "lldp_global",
            "lldp_interfaces",
            "ospf",
            "ospf_interfaces",
            "ospfv3",
            "static_routes",
            "vlans"
        ],
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "available_network_resources": true,
            "config_format": "text",
            "gather_network_resources": null,
            "gather_subset": [
                "!all"
            ],
            "provider": null
        }
    }
}

junos_interfaces issue

SUMMARY

junos_interfaces resulting in an error when passing in {{ interfaces }} var that is gathered via network_resources

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_interfaces

ANSIBLE VERSION
โžœ  ansible_locker git:(feature/banner) โœ— ansible --version
ansible 2.9.6
  config file = /Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg
  configured module search path = [u'/Users/gdykeman/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.16 (default, Oct 16 2019, 00:34:56) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]
CONFIGURATION
DEFAULT_CALLBACK_WHITELIST(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = [u'time']
DEFAULT_FORKS(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = 50
DEFAULT_HOST_LIST(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = [u'/Users/gdykeman/Documents/Ansible/multivendor_network/multivendor_inventory/dev_hosts.yaml']
DEFAULT_NO_TARGET_SYSLOG(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = False
DEFAULT_PRIVATE_KEY_FILE(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = /Users/gdykeman/.ssh/gdykeman-dev-network.pem
DEFAULT_SCP_IF_SSH(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = yaml
HOST_KEY_CHECKING(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = False
INTERPRETER_PYTHON(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = auto_silent
PERSISTENT_COMMAND_TIMEOUT(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = 200
PERSISTENT_CONNECT_TIMEOUT(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = 200
RETRY_FILES_ENABLED(/Users/gdykeman/Documents/Ansible/ansible_locker/ansible.cfg) = False
OS / ENVIRONMENT

MacOS

STEPS TO REPRODUCE
    interfaces:
      - enabled: true
        name: gr-0/0/0
      - enabled: true
        name: lo0
      - enabled: true
        name: fxp0
  tasks:
    - name: Configure Interfaces with provided data model
      junos_interfaces:
        config:  "{{ interfaces }}"
        state: replaced
EXPECTED RESULTS

Configuration of interfaces according to data set

ACTUAL RESULTS
TASK [Configure Interfaces with provided data model] ************************************************************
fatal: [juniper1]: FAILED! => changed=false
  ansible_facts:
    discovered_interpreter_python: /usr/bin/python
  msg: |-
    <?xml version="1.0" encoding="UTF-8"?><rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/18.4R1/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ed9ac575-d07e-48a2-94ba-0c4f1809ae43">
    <load-configuration-results>
    <rpc-error>
    <error-severity>warning</error-severity>
    <error-path>[edit interfaces gr-0/0/0]</error-path>
    <error-message>statement not found: description</error-message>
    </rpc-error>
    <rpc-error>
    <error-type>protocol</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>syntax error</error-message>
    <error-info>
    <bad-element>speed</bad-element>
    </error-info>
    </rpc-error>
    <load-error-count>2</load-error-count>
    </load-configuration-results>
    </rpc-reply>

unnecessary prefix junos_ for plugins while already in a junos_collection

SUMMARY

is it possible to shorten the plugins name by removing the junos_ prefix ? it bring nothing because they belong to the junos collection anyway and make the plugin name unnecessary long.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

all plugins

ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

junos_facts module fails on certain junos device

SUMMARY

junos_facts module is failing with the below error:

          "junos_facts": {
            "exception": "Traceback (most recent call last):\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-local-27649iggzzhtu/ansible-tmp-1612322295.7255182-27665-26343949901426/AnsiballZ_junos_facts.py\\", line 102, in <module>\\n    _ansiballz_main()\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-local-27649iggzzhtu/ansible-tmp-1612322295.7255182-27665-26343949901426/AnsiballZ_junos_facts.py\\", line 94, in _ansiballz_main\\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-local-27649iggzzhtu/ansible-tmp-1612322295.7255182-27665-26343949901426/AnsiballZ_junos_facts.py\\", line 40, in invoke_module\\n    runpy.run_module(mod_name='ansible.modules.network.junos.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)\\n  File \\"/usr/lib64/python3.6/runpy.py\\", line 205, in run_module\\n    return _run_module_code(code, init_globals, run_name, mod_spec)\\n  File \\"/usr/lib64/python3.6/runpy.py\\", line 96, in _run_module_code\\n    mod_name, mod_spec, pkg_name, script_name)\\n  File \\"/usr/lib64/python3.6/runpy.py\\", line 85, in _run_code\\n    exec(code, run_globals)\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py\\", line 135, in <module>\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py\\", line 126, in main\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/facts.py\\", line 78, in get_facts\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/facts/facts.py\\", line 124, in get_network_legacy_facts\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/legacy/base.py\\", line 112, in populate\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/legacy/base.py\\", line 50, in rpc\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/netconf.py\\", line 53, in exec_rpc\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/netconf.py\\", line 76, in __rpc__\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/netconf.py\\", line 105, in parse_rpc_error\\nansible.module_utils.connection.ConnectionError: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><rpc-error xmlns=\\"urn:ietf:params:xml:ns:netconf:base:1.0\\" xmlns:junos=\\"http://xml.juniper.net/junos/11.4R2/junos\\" xmlns:nc=\\"urn:ietf:params:xml:ns:netconf:base:1.0\\">\\n<error-severity>error</error-severity>\\n<error-info>\\n<bad-element>get-system-memory-information</bad-element>\\n</error-info>\\n<error-message>syntax error</error-message>\\n</rpc-error>\\n\\n",
ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_facts

ANSIBLE VERSION
ansible-playbook 2.9.8
  config file = /tmp/awx_4633_ich1tt6k/project/ansible.cfg
  configured module search path = ['/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/library']
  ansible python module location = /opt/my-envs/juniper/lib/python3.6/site-packages/ansible
  executable location = /opt/my-envs/juniper/bin/ansible-playbook
  python version = 3.6.8 (default, Aug 13 2020, 07:46:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION

OS / ENVIRONMENT

Junos OS:

JUNOS Base OS boot [11.4R7.5]
JUNOS Base OS boot [11.4R2.14]
Junos: 18.4R2-S2.3 flex

STEPS TO REPRODUCE

Use the following playbook on above Junos OS version device:

- name: collect default set of facts
  connection: network_cli
  junos_facts:
    gather_subset: config
#    connection: network_cli
    timeout: 60
  connection: network_cli
  register: device_facts
  always_run: yes


EXPECTED RESULTS

It should work fine

ACTUAL RESULTS

It fails with below error:

"junos_facts": {
            "exception": "Traceback (most recent call last):\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-local-27649iggzzhtu/ansible-tmp-1612322295.7255182-27665-26343949901426/AnsiballZ_junos_facts.py\\", line 102, in <module>\\n    _ansiballz_main()\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-local-27649iggzzhtu/ansible-tmp-1612322295.7255182-27665-26343949901426/AnsiballZ_junos_facts.py\\", line 94, in _ansiballz_main\\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-local-27649iggzzhtu/ansible-tmp-1612322295.7255182-27665-26343949901426/AnsiballZ_junos_facts.py\\", line 40, in invoke_module\\n    runpy.run_module(mod_name='ansible.modules.network.junos.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)\\n  File \\"/usr/lib64/python3.6/runpy.py\\", line 205, in run_module\\n    return _run_module_code(code, init_globals, run_name, mod_spec)\\n  File \\"/usr/lib64/python3.6/runpy.py\\", line 96, in _run_module_code\\n    mod_name, mod_spec, pkg_name, script_name)\\n  File \\"/usr/lib64/python3.6/runpy.py\\", line 85, in _run_code\\n    exec(code, run_globals)\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py\\", line 135, in <module>\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py\\", line 126, in main\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/facts.py\\", line 78, in get_facts\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/facts/facts.py\\", line 124, in get_network_legacy_facts\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/legacy/base.py\\", line 112, in populate\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/legacy/base.py\\", line 50, in rpc\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/netconf.py\\", line 53, in exec_rpc\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/netconf.py\\", line 76, in __rpc__\\n  File \\"/tmp/ansible_junos_facts_payload_8e8lq5j0/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/netconf.py\\", line 105, in parse_rpc_error\\nansible.module_utils.connection.ConnectionError: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><rpc-error xmlns=\\"urn:ietf:params:xml:ns:netconf:base:1.0\\" xmlns:junos=\\"http://xml.juniper.net/junos/11.4R2/junos\\" xmlns:nc=\\"urn:ietf:params:xml:ns:netconf:base:1.0\\">\\n<error-severity>error</error-severity>\\n<error-info>\\n<bad-element>get-system-memory-information</bad-element>\\n</error-info>\\n<error-message>syntax error</error-message>\\n</rpc-error>\\n\\n",

Error with junipernetworks.junos.junos_facts

SUMMARY

While using the junos_facts module, I am getting the following error:

fatal: [junos]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "module_stderr": "/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py:88: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.\nTraceback (most recent call last):\n  File \"/home/niks/.ansible/tmp/ansible-local-99876oy0vefei/ansible-tmp-1610442311.983957-99882-242343745352420/AnsiballZ_junos_facts.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/niks/.ansible/tmp/ansible-local-99876oy0vefei/ansible-tmp-1610442311.983957-99882-242343745352420/AnsiballZ_junos_facts.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/niks/.ansible/tmp/ansible-local-99876oy0vefei/ansible-tmp-1610442311.983957-99882-242343745352420/AnsiballZ_junos_facts.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py\", line 147, in <module>\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py\", line 138, in main\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py\", line 114, in get_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py\", line 131, in get_network_resources_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py\", line 92, in populate_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py\", line 168, in render_config\nTypeError: list indices must be integers or slices, not str\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_facts

ANSIBLE VERSION
2.9.13
OS / ENVIRONMENT

junos-vsrx3-x86-64-20.2R2.11-appsec4

STEPS TO REPRODUCE
  1. Create policy prefix list:
root@vsrx# set policy-options prefix-list ospf-all-routers
root@vsrx# set policy-options prefix-list ipv4-interfaces
root@vsrx# show policy-options
prefix-list ospf-all-routers;
prefix-list ipv4-interfaces;
  1. Create firewall filter with destination-prefix-list:
root@vsrx# set firewall family inet filter PROTECT-RE term allow-ospf from destination-prefix-list ospf-all-routers
root@vsrx# set firewall family inet filter PROTECT-RE term allow-ospf from destination-prefix-list ipv4-interfaces
root@vsrx# set firewall family inet filter PROTECT-RE term allow-ospf from source-prefix-list ipv4-interfaces
root@vsrx# show firewall
family inet {
    filter PROTECT-RE {
        term allow-ospf {
            from {
               source-prefix-list {
                    ipv4-interfaces;
                }
                destination-prefix-list {
                    ospf-all-routers;
                    ipv4-interfaces;
                }
            }
        }
    }
}
  1. Commit configuration:
root@vsrx# commit check
configuration check succeeds
root@vsrx# commit
commit complete
  1. Launch the following playbook to see the behavior of junos_facts:
---
- hosts: junos
  gather_facts: no

  tasks:
    - junipernetworks.junos.junos_facts:
        gather_subset: all
        gather_network_resources: all
  1. Run the playbook:
ansible-playbook -i inventory test_junos_facts.yml -v
EXPECTED RESULTS

Playbook should work

ACTUAL RESULTS

Playbook fails with below error:

fatal: [junos]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "module_stderr": "/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py:88: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.\nTraceback (most recent call last):\n  File \"/home/niks/.ansible/tmp/ansible-local-99876oy0vefei/ansible-tmp-1610442311.983957-99882-242343745352420/AnsiballZ_junos_facts.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/niks/.ansible/tmp/ansible-local-99876oy0vefei/ansible-tmp-1610442311.983957-99882-242343745352420/AnsiballZ_junos_facts.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/niks/.ansible/tmp/ansible-local-99876oy0vefei/ansible-tmp-1610442311.983957-99882-242343745352420/AnsiballZ_junos_facts.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py\", line 147, in <module>\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py\", line 138, in main\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py\", line 114, in get_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py\", line 131, in get_network_resources_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py\", line 92, in populate_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_wcgt6qwi/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py\", line 168, in render_config\nTypeError: list indices must be integers or slices, not str\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Error with junipernetworks.junos.junos_facts

SUMMARY

I tried to run the juniper fact gather playbook from the example. But with gather_network_resources: all I get an error.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_facts

ANSIBLE VERSION
ansible 2.10.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/local/lib/python3.6/site-packages/napalm_ansible']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.6/site-packages/napalm_ansible']
OS / ENVIRONMENT

CentOS Linux release 8.2.2004 (Core)

STEPS TO REPRODUCE

Install ansible with pip. Install junipernetworks with ansible-galaxy.
My playbook fails:

---
- name: Test
  hosts: switch03
  gather_facts: False
  vars:
    ansible_network_os: junipernetworks.junos.junos
  
  tasks:
  - name: Test
    junipernetworks.junos.junos_command:
      commands: show verison

  - name: Facts
    junipernetworks.junos.junos_facts:
      gather_subset: config
      gather_network_resources: all
EXPECTED RESULTS

shows facts.

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/home/misch/.ansible/tmp/ansible-local-8564egev84je/ansible-tmp-1604664421.3118272-8613-165773920193520/AnsiballZ_junos_facts.py", line 102, in <module>
    _ansiballz_main()
  File "/home/misch/.ansible/tmp/ansible-local-8564egev84je/ansible-tmp-1604664421.3118272-8613-165773920193520/AnsiballZ_junos_facts.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/misch/.ansible/tmp/ansible-local-8564egev84je/ansible-tmp-1604664421.3118272-8613-165773920193520/AnsiballZ_junos_facts.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py", line 147, in <module>                                                                                                                              
  File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py", line 138, in main                                                                                                                                  
  File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py", line 115, in get_facts                                                                                                          
  File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 128, in get_network_resources_facts                                                                                           
  File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py", line 90, in populate_facts                                                                              
  File "/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py", line 127, in render_config                                                                              
TypeError: list indices must be integers or slices, not str
fatal: [switch03]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/misch/.ansible/tmp/ansible-local-8564egev84je/ansible-tmp-1604664421.3118272-8613-165773920193520/AnsiballZ_junos_facts.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/misch/.ansible/tmp/ansible-local-8564egev84je/ansible-tmp-1604664421.3118272-8613-165773920193520/AnsiballZ_junos_facts.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/misch/.ansible/tmp/ansible-local-8564egev84je/ansible-tmp-1604664421.3118272-8613-165773920193520/AnsiballZ_junos_facts.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py\", line 147, in <module>\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py\", line 138, in main\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py\", line 115, in get_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py\", line 128, in get_network_resources_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py\", line 90, in populate_facts\n  File \"/tmp/ansible_junipernetworks.junos.junos_facts_payload_44vkk0ka/ansible_junipernetworks.junos.junos_facts_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py\", line 127, in render_config\nTypeError: list indices must be integers or slices, not str\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
ADDITIONAL INFO

When I leave out the last list, so only have

  - name: Facts
    junipernetworks.junos.junos_facts:
      gather_subset: config

my playbook works.

Improve test coverage for Juniper resource modules

SUMMARY

Enhance tests coverage for following juniper resource modules:

  • junos_bgp_global #164
  • junos_address_family #185
  • junos_vlans #206
  • junos_ospfv2 #207
ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Unable to run junos_user with root username

SUMMARY

Running junos_user module with root user and ecrypted_password results in an error

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_user

ANSIBLE VERSION
ansible 2.10.5
  config file = /home/gianni/git/update-scripts/ansible.cfg
  configured module search path = ['/home/gianni/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gianni/git/update-scripts/env/lib/python3.9/site-packages/ansible
  executable location = /home/gianni/git/update-scripts/env/bin/ansible
  python version = 3.9.1 (default, Feb  6 2021, 06:49:13) [GCC 10.2.0]

CONFIGURATION
ANSIBLE_PIPELINING(/home/gianni/git/update-scripts/ansible.cfg) = True
DEFAULT_CALLBACK_WHITELIST(/home/gianni/git/update-scripts/ansible.cfg) = ['profile_tasks']
DEFAULT_STDOUT_CALLBACK(/home/gianni/git/update-scripts/ansible.cfg) = debug
DEFAULT_VAULT_PASSWORD_FILE(/home/gianni/git/update-scripts/ansible.cfg) = /home/gianni/git/update-scripts/.vault_pass.txt
DISPLAY_SKIPPED_HOSTS(/home/gianni/git/update-scripts/ansible.cfg) = False
HOST_KEY_CHECKING(/home/gianni/git/update-scripts/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/gianni/git/update-scripts/ansible.cfg) = False

OS / ENVIRONMENT

Junos 18.2R3-S6.5

STEPS TO REPRODUCE

Running a playbook with the following config

- name: change admin user account password
  junos_user:
    name: root
    encrypted_password: "{{ 'test' | password_hash('sha512')}}" 
EXPECTED RESULTS

root user password is changed to test

ACTUAL RESULTS
Trying secret FileVaultSecret(filename='/home/gianni/git/update-scripts/.vault_pass.txt') for vault_id=default
Trying secret FileVaultSecret(filename='/home/gianni/git/update-scripts/.vault_pass.txt') for vault_id=default
redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf
Loading collection ansible.netcommon from /home/gianni/git/update-scripts/env/lib/python3.9/site-packages/ansible_collections/ansible/netcommon
redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos
<10.110.1.226> attempting to start connection
<10.110.1.226> using connection plugin ansible.netcommon.netconf
Found ansible-connection at path /home/gianni/git/update-scripts/env/bin/ansible-connection
<10.110.1.226> local domain socket does not exist, starting it
<10.110.1.226> control socket path is /home/gianni/.ansible/pc/980f88fe45
<10.110.1.226> redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf
<10.110.1.226> Loading collection ansible.netcommon from /home/gianni/git/update-scripts/env/lib/python3.9/site-packages/ansible_collections/ansible/netcommon
<10.110.1.226> redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos
<10.110.1.226> Loading collection junipernetworks.junos from /home/gianni/git/update-scripts/env/lib/python3.9/site-packages/ansible_collections/junipernetworks/junos
<10.110.1.226> Trying secret FileVaultSecret(filename='/home/gianni/git/update-scripts/.vault_pass.txt') for vault_id=default
<10.110.1.226> local domain socket listeners started successfully
<10.110.1.226> loaded netconf plugin ansible_collections.junipernetworks.junos.plugins.netconf.junos from path /home/gianni/git/update-scripts/env/lib/python3.9/site-packages/ansible_collections/junipernetworks/junos/plugins/netconf/junos.py for network_os junos
<10.110.1.226> 
<10.110.1.226> local domain socket path is /home/gianni/.ansible/pc/980f88fe45
Trying secret FileVaultSecret(filename='/home/gianni/git/update-scripts/.vault_pass.txt') for vault_id=default
redirecting (type: action) ansible.builtin.junos to junipernetworks.junos.junos
redirecting (type: action) ansible.builtin.junos to junipernetworks.junos.junos
<10.110.1.226> ESTABLISH LOCAL CONNECTION FOR USER: gianni
<10.110.1.226> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq `"&& mkdir "` echo /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827 `" && echo ansible-tmp-1613146142.6918576-60994-41600617722827="` echo /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.junos_user to junipernetworks.junos.junos_user
<testdevice> Attempting python interpreter discovery
<10.110.1.226> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<testdevice> Python interpreter discovery fallback (pipelining support required for extended interpreter discovery)
Using module file /home/gianni/git/update-scripts/env/lib/python3.9/site-packages/ansible_collections/junipernetworks/junos/plugins/modules/junos_user.py
<10.110.1.226> PUT /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/tmp7ngfw9fn TO /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827/AnsiballZ_junos_user.py
<10.110.1.226> EXEC /bin/sh -c 'chmod u+x /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827/ /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827/AnsiballZ_junos_user.py && sleep 0'
<10.110.1.226> EXEC /bin/sh -c '/usr/bin/python /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827/AnsiballZ_junos_user.py && sleep 0'
<10.110.1.226> EXEC /bin/sh -c 'rm -f -r /home/gianni/.ansible/tmp/ansible-local-60979msbmoywq/ansible-tmp-1613146142.6918576-60994-41600617722827/ > /dev/null 2>&1 && sleep 0'

TASK [clearpass : change admin user account password] ************************************************************************************************************************************************************
task path: /home/gianni/git/update-scripts/roles/clearpass/tasks/juniper.yml:30
The full traceback is:
  File "/tmp/ansible_junos_user_payload_7p1cquuf/ansible_junos_user_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py", line 195, in load_configuration
    return conn.load_configuration(
  File "/tmp/ansible_junos_user_payload_7p1cquuf/ansible_junos_user_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 80, in __rpc__
    return self.parse_rpc_error(
  File "/tmp/ansible_junos_user_payload_7p1cquuf/ansible_junos_user_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 121, in parse_rpc_error
    raise ConnectionError(
[WARNING]: Platform linux on host testdevice is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
fatal: [testdevice]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "active": true,
            "aggregate": null,
            "encrypted_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "full_name": null,
            "name": "root",
            "provider": null,
            "purge": false,
            "role": null,
            "sshkey": null,
            "state": "present"
        }
    }
}

MSG:

<?xml version="1.0" encoding="UTF-8"?><rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/18.2R3/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:b0aa5558-638f-411b-ada8-cc112a11e20e">
<load-configuration-results>
<rpc-error>
<error-severity>warning</error-severity>
<error-path>[edit system]</error-path>
<error-message>mgd: statement has no contents; ignored</error-message>
<error-info>
<bad-element>login</bad-element>
</error-info>
</rpc-error>
<rpc-error>
<error-type>protocol</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message>syntax error</error-message>
<error-info>
<bad-element>authentication</bad-element>
</error-info>
</rpc-error>
<rpc-error>
<error-type>protocol</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message>syntax error</error-message>
<error-info>
<bad-element>authentication</bad-element>
</error-info>
</rpc-error>
<load-error-count>2</load-error-count>
</load-configuration-results>
</rpc-reply>

junos_netconf suggestion or issue?

SUMMARY

Running a simple playbook to enable netconf, by default sends the "set system services netconf ssh port 830".
I would like the module to check on the Idempotency if the device already have a "system services netconf ssh", if it does, then don't do anything.
Also, it could be the reverse, the module could send the "set system services netconf ssh" and compare it to "set system services netconf ssh port 830", and if it is there, don't do anything.

Another Parameter that is not on the module and we would like to have, if possible of course, is the "confirm_commit" option, the same way as the "junos_config" module.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible 2.10.5
  config file = /home/user1/m-ansible/ansible/ansible.cfg
  configured module search path = ["/home/user1/m-ansible/ansible/'/home/user1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules', '/home/user1/m-ansible/ansible/library'"]
  ansible python module location = /home/user1/m-ansible/lib/python3.7/site-packages/ansible
  executable location = /home/user1/m-ansible/bin/ansible
  python version = 3.7.3 (default, Apr  3 2019, 05:39:12) [GCC 8.3.0]
CONFIGURATION
DEFAULT_FORKS(/home/user1/m-ansible/ansible/ansible.cfg) = 8
DEFAULT_HOST_LIST(/home/user1/m-ansible/ansible/ansible.cfg) = ['/home/user1/m-ansible/ansible/hosts']
DEFAULT_MODULE_PATH(/home/user1/m-ansible/ansible/ansible.cfg) = ["/home/user1/m-ansible/ansible/'/home/user1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules', '/home/user1/m-ansible/ansible/library'"]
DEFAULT_PRIVATE_KEY_FILE(/home/user1/m-ansible/ansible/ansible.cfg) = /home/user1/.ssh/myotherkey.pem
DEFAULT_REMOTE_USER(/home/user1/m-ansible/ansible/ansible.cfg) = hvargas
DEFAULT_TIMEOUT(/home/user1/m-ansible/ansible/ansible.cfg) = 57
DEPRECATION_WARNINGS(/home/user1/m-ansible/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/home/user1/m-ansible/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/home/user1/m-ansible/ansible/ansible.cfg) = /home/user1/m-ansible/bin/python3
INVENTORY_ENABLED(/home/user1/m-ansible/ansible/ansible.cfg) = ['yaml', 'netbox', 'host_list', 'ini', 'virtualbox', 'constructed']
PARAMIKO_HOST_KEY_AUTO_ADD(/home/user1/m-ansible/ansible/ansible.cfg) = True
PARAMIKO_LOOK_FOR_KEYS(/home/user1/m-ansible/ansible/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/home/user1/m-ansible/ansible/ansible.cfg) = 60
PERSISTENT_CONNECT_TIMEOUT(/home/user1/m-ansible/ansible/ansible.cfg) = 68
RETRY_FILES_ENABLED(/home/user1/m-ansible/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Using WSL on Windows 10
PRETTY_NAME="Debian GNU/Linux 10 (buster)"

Juniper device:
--- JUNOS 18.1R3.3 Kernel 32-bit JNPR-11.0-20180816.8630ec5_buil
Juniper EX3400-24P

STEPS TO REPRODUCE

Generally on my team we only use "set system services netconf ssh" so technically if the playbook does not have the "listens_on" or the "netconf_port", it should send only the command "set system services netconf ssh".
If it has the the "listens_on" or "netconf_port" then it should send the command "set system services netconf ssh port 830".

  collections:
    - junipernetworks.junos
  gather_facts: no
  vars:
    ansible_connection: network_cli
    ansible_network_os: junos
  tasks:
    - name: ENABLE NETCONF
      junipernetworks.junos.junos_netconf:
        state: present
      register: test
EXPECTED RESULTS

"set system services netconf ssh" sent to the device with a commit confirmed.

ACTUAL RESULTS
set system services netconf ssh port 830 is sent to the device.

Mask sensitive keys in task result

Sensitive keys (including but not limited to the ones detected by validate-modules) should have no_log: True so that their values are correctly redacted from the task result.
Also bump the min requirement for netcommon up in galaxy.yml "ansible.netcommon": ">=2.0.1".

Support for Junos OS Evolved

SUMMARY

Support for future releases of Junos OS Evolved.

Junos Evo runs on Linux instead of FreeBSD.

Issue opened to facilitate discussion on future development of the collection, not to request specific feature.

Allow configuration to be committed in private mode

SUMMARY

Currently by default configuration is done over netconf in an exclusive mode that is before edit operation a lock netconf RPC is sent to enter the candidate configuration datastore in exclusive mode and after commit is done issues an unlock RPC. To support private mode a configuration variable can be added at the junos netconf plugin level (since it applies to all the junos modules) to not execute lock and unlock RPC's before and after configuration is done.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

plugins/netconf/junos.py

ADDITIONAL INFORMATION

gathered operation doesn't work with junos_l2_interfaces resource module

SUMMARY

gathered operation for junos_l2_interfaces resource module resulting in traceback

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_l2_interfaces

ANSIBLE VERSION
ansible 2.10.0.dev0
CONFIGURATION
ansible_network_os=junipernetworks.junos.junos
ansible_connection=ansible.netcommon.netconf
OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- name: Merged Operation
  hosts: junos-rdo
  collections:
    - junipernetworks.junos
  tasks:
    - name: "gather facts for junos layer 2 interfaces"
      junipernetworks.junos.junos_l2_interfaces:
        state: gathered
EXPECTED RESULTS
ACTUAL RESULTS
  File "/home/rothakur/.ansible/tmp/ansible-local-390861rya92fr2/ansible-tmp-1596608346.921165-274948048423981/AnsiballZ_junos_l2_interfaces.py", line 102, in <module>
    _ansiballz_main()
  File "/home/rothakur/.ansible/tmp/ansible-local-390861rya92fr2/ansible-tmp-1596608346.921165-274948048423981/AnsiballZ_junos_l2_interfaces.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/rothakur/.ansible/tmp/ansible-local-390861rya92fr2/ansible-tmp-1596608346.921165-274948048423981/AnsiballZ_junos_l2_interfaces.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_l2_interfaces', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.8/runpy.py", line 206, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.8/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib64/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_junipernetworks.junos.junos_l2_interfaces_payload_qlfjwq11/ansible_junipernetworks.junos.junos_l2_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interfaces.py", line 414, in <module>
  File "/tmp/ansible_junipernetworks.junos.junos_l2_interfaces_payload_qlfjwq11/ansible_junipernetworks.junos.junos_l2_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interfaces.py", line 409, in main
  File "/tmp/ansible_junipernetworks.junos.junos_l2_interfaces_payload_qlfjwq11/ansible_junipernetworks.junos.junos_l2_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py", line 82, in execute_module
  File "/tmp/ansible_junipernetworks.junos.junos_l2_interfaces_payload_qlfjwq11/ansible_junipernetworks.junos.junos_l2_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py", line 122, in set_config
  File "/tmp/ansible_junipernetworks.junos.junos_l2_interfaces_payload_qlfjwq11/ansible_junipernetworks.junos.junos_l2_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py", line 145, in set_state
UnboundLocalError: local variable 'config_xmls' referenced before assignment

junos_config.rollback=0 returns ok even if there is no route to the device

Here is my playbook.

---
- name: junos_config.rollback
  hosts: hp_dev
  connection: netconf
  tasks:
    - name: junos_config.rollback
      junos_config:
        rollback: "{{ commit_id }}"

If the value of commit_id=10, it throws error due to not able to connect to the junos device.
For commit_id=0, it outputs runner_on_ok event

I see a code IF NUMBER, and here the number can be zero. I am not sure it is the issue.

junipernetworks.junos.junos_interfaces fails when trying to configure AE-interface

SUMMARY

When I try to use the junos_interfaces module to set Description or MTU on an Aggregated Ethernet (AE) interface, the task fails. Works when trying to configure a normal physical interface such as 'ge-0/0/1'.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_interfaces

ANSIBLE VERSION
ansible --version
ansible 2.10.6
  config file = /home/<user>/gclone/project-network-switch-ports/ansible.cfg
  configured module search path = ['/home/<user>/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/<user>/.local/lib/python3.8/site-packages/ansible
  executable location = /home/<user>/.local/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
CONFIGURATION
ansible-config dump --only-changed
DEFAULT_HOST_LIST(/home/<user>/gclone/project-network-switch-ports/ansible.cfg) = ['/home/<user>/gclone/project-network-switch-ports/hosts']
HOST_KEY_CHECKING(/home/<user>/gclone/project-network-switch-ports/ansible.cfg) = False
OS / ENVIRONMENT

Running Ansible on Windows using WSLv1 with 'Ubuntu 20.4 LTS'.
Target network devices are Juniper EX3400 switches running 'JUNOS 18.2R3-S4.1 Kernel 32-bit'

STEPS TO REPRODUCE

To reproduce, use the junos_interfaces module to try configure an AE-interface.

- name: Configure switch interface (Description & MTU)
  vars:
    ansible_command_timeout: 60
  junos_interfaces:
    config:
      - name: ae1
        mtu: 1500
        description: Configured with Ansible
    state: replaced
EXPECTED RESULTS

If AE-interface does not already exist, expect that the interface will be created. Expected that the AE interface will be configured with MTU set to 1500, and Description set to "Configured with Ansible".

ACTUAL RESULTS

Task fails with some Netconf error. I can see error stating "[edit interfaces ae1] - statement not found: description". Configuring description on AE-interfaces uses the exact same syntax as when configuring on a regular ge- or xe-interface.

The full traceback is:
  File "/tmp/ansible_junos_interfaces_payload_qt8u1sfb/ansible_junos_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py", line 195, in load_configuration
    return conn.load_configuration(
  File "/tmp/ansible_junos_interfaces_payload_qt8u1sfb/ansible_junos_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 80, in __rpc__
    return self.parse_rpc_error(
  File "/tmp/ansible_junos_interfaces_payload_qt8u1sfb/ansible_junos_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 121, in parse_rpc_error
    raise ConnectionError(
fatal: [EX3400]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "config": [
                {
                    "description": "Configured with Ansible",
                    "duplex": null,
                    "enabled": true,
                    "hold_time": null,
                    "mtu": 1500,
                    "name": "ae1",
                    "speed": null
                }
            ],
            "running_config": null,
            "state": "replaced"
        }
    },
    "msg": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" xmlns:junos=\"http://xml.juniper.net/junos/18.2R3/junos\" xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"urn:uuid:87d7ec59-0a8e-41ce-830b-b87072e8fc2d\">\n<load-configuration-results>\n<rpc-error>\n<error-severity>warning</error-severity>\n<error-path>[edit interfaces ae1]</error-path>\n<error-message>statement not found: description</error-message>\n</rpc-error>\n<rpc-error>\n<error-type>protocol</error-type>\n<error-tag>operation-failed</error-tag>\n<error-severity>error</error-severity>\n<error-message>syntax error</error-message>\n<error-info>\n<bad-element>speed</bad-element>\n</error-info>\n</rpc-error>\n<load-error-count>2</load-error-count>\n</load-configuration-results>\n</rpc-reply>"

Allow variables and lookup modules as src for junos_config

SUMMARY

Allow variables (and by that lookup modules) as src for junos_config so that no temporary file is needed.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

junos_config

ADDITIONAL INFORMATION

Currently the src parameter in the junos_config module can only reference a filename on disk and NOT a variable or lookup module. To use for example the template engine without temporary files it would be nice if the src parameter could also contain the config itself so it can be used with a template lookup like this for example:

- name: load configure file into device
  junos_config:
    src: "{{ lookup('template', 'my_junos_config.j2') }}"
    update: replace
    comment: update config

Right now this takes two steps, a) writing the template to temporary file on disk and b) pushing the configuration.

junos_config: diff module output not displayed correctly ( Human readable) ; msg': \"Param 'provider' is deprecated

SUMMARY

junos_config: junos playbook not displaying diff output correctly and msg': "Param 'provider' is deprecated is displayed

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_config

ANSIBLE VERSION
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION
ACTION_WARNINGS(default) = True
AGNOSTIC_BECOME_PROMPT(default) = True
ALLOW_WORLD_READABLE_TMPFILES(default) = False
ANSIBLE_CONNECTION_PATH(default) = None
ANSIBLE_COW_PATH(default) = None
ANSIBLE_COW_SELECTION(default) = default
ANSIBLE_COW_WHITELIST(default) = ['bud-frogs', 'bunny', 'cheese', 'daemon', 'default', 'dragon', 'elephant-in-snake',>
ANSIBLE_FORCE_COLOR(default) = False
ANSIBLE_NOCOLOR(default) = False
ANSIBLE_NOCOWS(default) = False
ANSIBLE_PIPELINING(default) = False
ANSIBLE_SSH_ARGS(default) = -C -o ControlMaster=auto -o ControlPersist=60s
ANSIBLE_SSH_CONTROL_PATH(default) = None
ANSIBLE_SSH_CONTROL_PATH_DIR(default) = ~/.ansible/cp
ANSIBLE_SSH_EXECUTABLE(default) = ssh
ANSIBLE_SSH_RETRIES(default) = 0
ANY_ERRORS_FATAL(default) = False
BECOME_ALLOW_SAME_USER(default) = False
BECOME_PLUGIN_PATH(default) = ['/root/.ansible/plugins/become', '/usr/share/ansible/plugins/become']
CACHE_PLUGIN(default) = memory
CACHE_PLUGIN_CONNECTION(default) = None
CACHE_PLUGIN_PREFIX(default) = ansible_facts
CACHE_PLUGIN_TIMEOUT(default) = 86400
COLLECTIONS_PATHS(default) = ['/root/.ansible/collections', '/usr/share/ansible/collections']
COLOR_CHANGED(default) = yellow
COLOR_CONSOLE_PROMPT(default) = white
COLOR_DEBUG(default) = dark gray
COLOR_DEPRECATE(default) = purple
COLOR_DIFF_ADD(default) = green
COLOR_DIFF_LINES(default) = cyan
COLOR_DIFF_REMOVE(default) = red
COLOR_ERROR(default) = red
COLOR_HIGHLIGHT(default) = white
COLOR_OK(default) = green
COLOR_SKIP(default) = cyan
COLOR_UNREACHABLE(default) = bright red
COLOR_VERBOSE(default) = blue
COLOR_WARN(default) = bright purple
COMMAND_WARNINGS(default) = True
CONDITIONAL_BARE_VARS(default) = True
CONNECTION_FACTS_MODULES(default) = {'eos': 'eos_facts', 'frr': 'frr_facts', 'ios': 'ios_facts', 'iosxr': 'iosxr_fact>
COVERAGE_REMOTE_OUTPUT(default) = None
COVERAGE_REMOTE_WHITELIST(default) = *
DEFAULT_ACTION_PLUGIN_PATH(default) = ['/root/.ansible/plugins/action', '/usr/share/ansible/plugins/action']
DEFAULT_ALLOW_UNSAFE_LOOKUPS(default) = False
DEFAULT_ASK_PASS(default) = False
DEFAULT_ASK_VAULT_PASS(default) = False
DEFAULT_BECOME(default) = False
DEFAULT_BECOME_ASK_PASS(default) = False
DEFAULT_BECOME_EXE(default) = None
DEFAULT_BECOME_FLAGS(default) = 
DEFAULT_BECOME_METHOD(default) = sudo
DEFAULT_BECOME_USER(default) = root
DEFAULT_CACHE_PLUGIN_PATH(default) = ['/root/.ansible/plugins/cache', '/usr/share/ansible/plugins/cache']
DEFAULT_CALLABLE_WHITELIST(default) = []
DEFAULT_CALLBACK_PLUGIN_PATH(default) = ['/root/.ansible/plugins/callback', '/usr/share/ansible/plugins/callback']
DEFAULT_CALLBACK_WHITELIST(default) = []
DEFAULT_CLICONF_PLUGIN_PATH(default) = ['/root/.ansible/plugins/cliconf', '/usr/share/ansible/plugins/cliconf']
DEFAULT_CONNECTION_PLUGIN_PATH(default) = ['/root/.ansible/plugins/connection', '/usr/share/ansible/plugins/connectio>
DEFAULT_DEBUG(default) = False
DEFAULT_EXECUTABLE(default) = /bin/sh
DEFAULT_FACT_PATH(default) = None
DEFAULT_FILTER_PLUGIN_PATH(default) = ['/root/.ansible/plugins/filter', '/usr/share/ansible/plugins/filter']
DEFAULT_FORCE_HANDLERS(default) = False
DEFAULT_FORKS(default) = 5
DEFAULT_GATHERING(default) = implicit
DEFAULT_GATHER_SUBSET(default) = ['all']
DEFAULT_GATHER_TIMEOUT(default) = 10
DEFAULT_HANDLER_INCLUDES_STATIC(default) = False
DEFAULT_HASH_BEHAVIOUR(default) = replace
DEFAULT_HOST_LIST(default) = ['/etc/ansible/hosts']
DEFAULT_HTTPAPI_PLUGIN_PATH(default) = ['/root/.ansible/plugins/httpapi', '/usr/share/ansible/plugins/httpapi']
DEFAULT_INTERNAL_POLL_INTERVAL(default) = 0.001
DEFAULT_INVENTORY_PLUGIN_PATH(default) = ['/root/.ansible/plugins/inventory', '/usr/share/ansible/plugins/inventory']
DEFAULT_JINJA2_EXTENSIONS(default) = []
DEFAULT_JINJA2_NATIVE(default) = False
DEFAULT_KEEP_REMOTE_FILES(default) = False
DEFAULT_LIBVIRT_LXC_NOSECLABEL(default) = False
DEFAULT_LOAD_CALLBACK_PLUGINS(default) = False
DEFAULT_LOCAL_TMP(default) = /root/.ansible/tmp/ansible-local-981k6lh2qkt
DEFAULT_LOG_FILTER(default) = []
DEFAULT_LOG_PATH(default) = None
DEFAULT_LOOKUP_PLUGIN_PATH(default) = ['/root/.ansible/plugins/lookup', '/usr/share/ansible/plugins/lookup']
DEFAULT_MANAGED_STR(default) = Ansible managed
DEFAULT_MODULE_ARGS(default) = 
DEFAULT_MODULE_COMPRESSION(default) = ZIP_DEFLATED
DEFAULT_MODULE_NAME(default) = command
DEFAULT_MODULE_PATH(default) = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
DEFAULT_MODULE_UTILS_PATH(default) = ['/root/.ansible/plugins/module_utils', '/usr/share/ansible/plugins/module_utils>
DEFAULT_NETCONF_PLUGIN_PATH(default) = ['/root/.ansible/plugins/netconf', '/usr/share/ansible/plugins/netconf']
DEFAULT_NO_LOG(default) = False
DEFAULT_NO_TARGET_SYSLOG(default) = False
DEFAULT_NULL_REPRESENTATION(default) = None
DEFAULT_POLL_INTERVAL(default) = 15
DEFAULT_PRIVATE_KEY_FILE(default) = None
DEFAULT_PRIVATE_ROLE_VARS(default) = False
DEFAULT_REMOTE_PORT(default) = None
DEFAULT_REMOTE_USER(default) = None
DEFAULT_ROLES_PATH(default) = ['/root/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
DEFAULT_SCP_IF_SSH(default) = smart
DEFAULT_SELINUX_SPECIAL_FS(default) = ['fuse', 'nfs', 'vboxsf', 'ramfs', '9p', 'vfat']
DEFAULT_SFTP_BATCH_MODE(default) = True
DEFAULT_SQUASH_ACTIONS(default) = ['apk', 'apt', 'dnf', 'homebrew', 'openbsd_pkg', 'pacman', 'pip', 'pkgng', 'yum', '>
DEFAULT_SSH_TRANSFER_METHOD(default) = None
DEFAULT_STDOUT_CALLBACK(default) = default
DEFAULT_STRATEGY(default) = linear
DEFAULT_STRATEGY_PLUGIN_PATH(default) = ['/root/.ansible/plugins/strategy', '/usr/share/ansible/plugins/strategy']
DEFAULT_SU(default) = False
DEFAULT_SYSLOG_FACILITY(default) = LOG_USER
DEFAULT_TASK_INCLUDES_STATIC(default) = False
DEFAULT_TERMINAL_PLUGIN_PATH(default) = ['/root/.ansible/plugins/terminal', '/usr/share/ansible/plugins/terminal']
DEFAULT_TEST_PLUGIN_PATH(default) = ['/root/.ansible/plugins/test', '/usr/share/ansible/plugins/test']
DEFAULT_TIMEOUT(default) = 10
DEFAULT_TRANSPORT(default) = smart
DEFAULT_UNDEFINED_VAR_BEHAVIOR(default) = True
DEFAULT_VARS_PLUGIN_PATH(default) = ['/root/.ansible/plugins/vars', '/usr/share/ansible/plugins/vars']
DEFAULT_VAULT_ENCRYPT_IDENTITY(default) = None
DEFAULT_VAULT_IDENTITY(default) = default
DEFAULT_VAULT_IDENTITY_LIST(default) = []
DEFAULT_VAULT_ID_MATCH(default) = False
DEFAULT_VAULT_PASSWORD_FILE(default) = None
DEFAULT_VERBOSITY(default) = 0
DEPRECATION_WARNINGS(default) = True
DIFF_ALWAYS(default) = False
DIFF_CONTEXT(default) = 3
DISPLAY_ARGS_TO_STDOUT(default) = False
DISPLAY_SKIPPED_HOSTS(default) = True
DOCSITE_ROOT_URL(default) = https://docs.ansible.com/ansible/
DOC_FRAGMENT_PLUGIN_PATH(default) = ['/root/.ansible/plugins/doc_fragments', '/usr/share/ansible/plugins/doc_fragment>
DUPLICATE_YAML_DICT_KEY(default) = warn
ENABLE_TASK_DEBUGGER(default) = False
ERROR_ON_MISSING_HANDLER(default) = True
FACTS_MODULES(default) = ['smart']
GALAXY_IGNORE_CERTS(default) = False
GALAXY_ROLE_SKELETON(default) = None
GALAXY_ROLE_SKELETON_IGNORE(default) = ['^.git$', '^.*/.git_keep$']
GALAXY_SERVER(default) = https://galaxy.ansible.com
GALAXY_SERVER_LIST(default) = None
GALAXY_TOKEN(default) = None
GALAXY_TOKEN_PATH(default) = /root/.ansible/galaxy_token
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
HOST_PATTERN_MISMATCH(default) = warning
INJECT_FACTS_AS_VARS(default) = True
INTERPRETER_PYTHON(default) = auto_legacy
INTERPRETER_PYTHON_DISTRO_MAP(default) = {'centos': {'6': '/usr/bin/python', '8': '/usr/libexec/platform-python'}, 'f>
INTERPRETER_PYTHON_FALLBACK(default) = ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'pytho>
INVALID_TASK_ATTRIBUTE_FAILED(default) = True
INVENTORY_ANY_UNPARSED_IS_FAILED(default) = False
INVENTORY_CACHE_ENABLED(default) = False
INVENTORY_CACHE_PLUGIN(default) = None
INVENTORY_CACHE_PLUGIN_CONNECTION(default) = None
INVENTORY_CACHE_PLUGIN_PREFIX(default) = ansible_facts
INVENTORY_CACHE_TIMEOUT(default) = 3600
INVENTORY_ENABLED(default) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml']
INVENTORY_EXPORT(default) = False
INVENTORY_IGNORE_EXTS(default) = {{(BLACKLIST_EXTS + ( '.orig', '.ini', '.cfg', '.retry'))}}
INVENTORY_IGNORE_PATTERNS(default) = []
INVENTORY_UNPARSED_IS_FAILED(default) = False
LOCALHOST_WARNING(default) = True
MAX_FILE_SIZE_FOR_DIFF(default) = 104448
NETCONF_SSH_CONFIG(default) = None
NETWORK_GROUP_MODULES(default) = ['eos', 'nxos', 'ios', 'iosxr', 'junos', 'enos', 'ce', 'vyos', 'sros', 'dellos9', 'd>
OLD_PLUGIN_CACHE_CLEARING(default) = False
PARAMIKO_HOST_KEY_AUTO_ADD(default) = False
PARAMIKO_LOOK_FOR_KEYS(default) = True
PERSISTENT_COMMAND_TIMEOUT(default) = 30
PERSISTENT_CONNECT_RETRY_TIMEOUT(default) = 15
PERSISTENT_CONNECT_TIMEOUT(default) = 30
PERSISTENT_CONTROL_PATH_DIR(default) = /root/.ansible/pc
PLAYBOOK_DIR(default) = None
PLAYBOOK_VARS_ROOT(default) = top
PLUGIN_FILTERS_CFG(default) = None
PYTHON_MODULE_RLIMIT_NOFILE(default) = 0
RETRY_FILES_ENABLED(default) = False
RETRY_FILES_SAVE_PATH(default) = None
SHOW_CUSTOM_STATS(default) = False
STRING_CONVERSION_ACTION(default) = warn
STRING_TYPE_FILTERS(default) = ['string', 'to_json', 'to_nice_json', 'to_yaml', 'ppretty', 'json']
SYSTEM_WARNINGS(default) = True
TAGS_RUN(default) = []
TAGS_SKIP(default) = []
TASK_DEBUGGER_IGNORE_ERRORS(default) = True
TRANSFORM_INVALID_GROUP_CHARS(default) = never
USE_PERSISTENT_CONNECTIONS(default) = False
VARIABLE_PRECEDENCE(default) = ['all_inventory', 'groups_inventory', 'all_plugins_inventory', 'all_plugins_play', 'gr>
VERBOSE_TO_STDERR(default) = False
YAML_FILENAME_EXTENSIONS(default) = ['.yml', '.yaml', '.json']
OS / ENVIRONMENT

OS = Redhat v 8.1

Target OS = 
Hostname: dmz-firewall
Model: vSRX
Junos: 19.2R1-S2.2
JUNOS OS Kernel 64-bit XEN [20191120.0ebd4bf_builder_stable_11]
JUNOS OS libs [20191120.0ebd4bf_builder_stable_11]
JUNOS OS runtime [20191120.0ebd4bf_builder_stable_11]
JUNOS OS time zone information [20191120.0ebd4bf_builder_stable_11]
JUNOS OS libs compat32 [20191120.0ebd4bf_builder_stable_11]
JUNOS OS 32-bit compatibility [20191120.0ebd4bf_builder_stable_11]
JUNOS py extensions [20191121.175308_builder_junos_192_r1_s2]
JUNOS py base [20191121.175308_builder_junos_192_r1_s2]
JUNOS OS vmguest [20191120.0ebd4bf_builder_stable_11]
JUNOS OS support utilities [20191120.0ebd4bf_builder_stable_11]
JUNOS OS crypto [20191120.0ebd4bf_builder_stable_11]
JUNOS network stack and utilities [20191121.175308_builder_junos_192_r1_s2]
JUNOS libs [20191121.175308_builder_junos_192_r1_s2]
JUNOS libs compat32 [20191121.175308_builder_junos_192_r1_s2]
JUNOS runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS na telemetry [19.2R1-S2.2]
JUNOS Web Management Platform Package [20191121.175308_builder_junos_192_r1_s2]
JUNOS vsrx modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx libs compat32 [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx platform support [20191121.175308_builder_junos_192_r1_s2]
JUNOS common platform support [20191121.175308_builder_junos_192_r1_s2]
JUNOS vsrx runtime [20191121.175308_builder_junos_192_r1_s2]
JUNOS pppoe [20191121.175308_builder_junos_192_r1_s2]
JUNOS Openconfig [19.2R1-S2.2]
JUNOS mtx network modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS modules [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx libs [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx Data Plane Crypto Support [20191121.175308_builder_junos_192_r1_s2]
JUNOS daemons [20191121.175308_builder_junos_192_r1_s2]
JUNOS srx daemons [20191121.175308_builder_junos_192_r1_s2]
JUNOS SRX TVP AppQos Daemon [20191121.175308_builder_junos_192_r1_s2]
JUNOS Extension Toolkit [20191121.175308_builder_junos_192_r1_s2]
JUNOS Juniper Malware Removal Tool (JMRT) [1.0.0+20191121.175308_builder_junos_192_r1_s2]
JUNOS J-Insight [20191121.175308_builder_junos_192_r1_s2]
JUNOS Online Documentation [20191121.175308_builder_junos_192_r1_s2]
JUNOS jail runtime [20191120.0ebd4bf_builder_stable_11]
JUNOS FIPS mode utilities [20191121.175308_builder_junos_192_r1_s2]
STEPS TO REPRODUCE
[juniper]
172.16.203.121

[juniper:vars]
ansible_user=****************
ansible_network_os=junipernetworks.junos.junos
ansible_connection=local
ansible_password=***************



- name: Juniper SRX configuration compliance checks 
  hosts: juniper
  gather_facts: false
  tasks:
  - set_fact:
         config_directory: '{{ "/home/gefelas/ansible_junos/files/" }}'
  - name: Syslog server check
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/syslog_config.txt'
      src_format: set
      comment: Ensure that appropriate Syslog server configured 
    register: junos_output
    diff: true
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: Syslog server check - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: Syslog server check - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
  
    
  - name: Admin credentials check
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/admin_user.txt'
      comment: Ensure that Admin user havee been created
    register: junos_output
    diff: true
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: Admin credentials check - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: Admin credentials check - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
      
    
  - name: NTP Server check 
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/NTP_server.txt'
      comment: Ensure that correct NTP servers has been configured
    register: junos_output
    diff: true
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: NTP Server check  - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: NTP Server check  - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
      
      
  - name: Idle timeout check 
    junipernetworks.junos.junos_config:
      src: '{{ config_directory }}/idle_timeout.txt'
      comment: Ensure that idle timeout has been configured
    register: junos_output
    diff: true
  - debug:
       var: junos_output
      
  - name: success
    debug:
      msg: Idle timeout check   - This check has passed with the following output({{ junos_output }})
    when: not junos_output.changed 
   
  - name: failed
    debug:
      msg: Idle timeout check   - This check has failed with the following output({{ junos_output }})
    when: junos_output.changed 
EXPECTED RESULTS

The results should be as a result of comparing the src directory against the configuration of juniper vsrx ... The src files are similar to these
https://github.com/gefela/ansible_junos/tree/master/files
However the output is not displayed correctly

ACTUAL RESULTS

When I run this command .

ansible-playbook -i inventory junos_config_new.yml --check -vvv

I get the following error message .

sudo ansible-playbook -i inventory junos_config_new.yml  --check -vvv
[sudo] password for gefelas: 
ansible-playbook 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /home/gefelas/ansible_junos/inventory as it did not pass its verify_file() method
script declined parsing /home/gefelas/ansible_junos/inventory as it did not pass its verify_file() method
auto declined parsing /home/gefelas/ansible_junos/inventory as it did not pass its verify_file() method
Parsed /home/gefelas/ansible_junos/inventory inventory source with ini plugin

PLAYBOOK: junos_config_new.yml *****************************************************************************************************************************
1 plays in junos_config_new.yml

PLAY [Juniper SRX configuration compliance checks] *********************************************************************************************************
META: ran handlers

TASK [set_fact] ********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:6
ok: [172.16.203.121] => {
    "ansible_facts": {
        "config_directory": "/home/gefelas/ansible_junos/files/"
    },
    "changed": false
}

TASK [Syslog server check] *********************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:8
<172.16.203.121> using connection plugin netconf (was local)
<172.16.203.121> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.16.203.121> EXEC /bin/sh -c 'echo ~root && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948 && echo ansible-tmp-1592490545.731142-52320-201879998426948="` echo /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948 `" ) && sleep 0'
<172.16.203.121> Attempting python interpreter discovery
<172.16.203.121> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/bin/python3.6 && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py
<172.16.203.121> PUT /root/.ansible/tmp/ansible-local-52311nkl6r8cg/tmpreqda8m6 TO /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948/AnsiballZ_junos_config.py
<172.16.203.121> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948/ /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/usr/libexec/platform-python /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592490545.731142-52320-201879998426948/ > /dev/null 2>&1 && sleep 0'
[edit system syslog host 192.168.100.70]
+     interactive-commands any;
[edit system syslog host 192.168.100.70]
+    facility-override local1;
+    log-prefix firewall;
+    source-address 172.16.203.121;
+    explicit-priority;
[edit system syslog]
+    file messages {
+        any critical;
+        authorization info;
+    }
+    file default-log-messages {
+        structured-data;
+    }
+    file sessions {
+        user info;
+    }
+    file interactive-commands {
+        interactive-commands error;
+    }
[DEPRECATION WARNING]: Param 'provider' is deprecated. See the module docs for more information. This feature will be removed in version 2.14. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
changed: [172.16.203.121] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": true,
    "diff": {
        "prepared": "[edit system syslog host 192.168.100.70]\n+     interactive-commands any;\n[edit system syslog host 192.168.100.70]\n+    facility-override local1;\n+    log-prefix firewall;\n+    source-address 172.16.203.121;\n+    explicit-priority;\n[edit system syslog]\n+    file messages {\n+        any critical;\n+        authorization info;\n+    }\n+    file default-log-messages {\n+        structured-data;\n+    }\n+    file sessions {\n+        user info;\n+    }\n+    file interactive-commands {\n+        interactive-commands error;\n+    }"
    },
    "invocation": {
        "module_args": {
            "backup": false,
            "backup_options": null,
            "check_commit": false,
            "comment": "Ensure that appropriate Syslog server configured",
            "confirm": 0,
            "confirm_commit": false,
            "lines": null,
            "provider": {
                "host": null,
                "password": null,
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "netconf",
                "username": null
            },
            "replace": null,
            "rollback": null,
            "src": "set system syslog archive size 300000\nset system syslog archive files 3\nset system syslog archive world-readable\nset system syslog user * any emergency\nset system syslog host 192.168.100.70 any any\nset system syslog host 192.168.100.70 interactive-commands any\nset system syslog host 192.168.100.70 facility-override local1\nset system syslog host 192.168.100.70 log-prefix firewall\nset system syslog host 192.168.100.70 source-address \"172.16.203.121\"\nset system syslog host 192.168.100.70 explicit-priority\nset system syslog file messages any critical\nset system syslog file messages authorization info\nset system syslog file default-log-messages structured-data\nset system syslog file sessions user info\nset system syslog file interactive-commands interactive-commands error\n",
            "src_format": "set",
            "update": "merge",
            "zeroize": false
        }
    }
}

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:15
ok: [172.16.203.121] => {
    "junos_output": {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/libexec/platform-python"
        },
        "changed": true,
        "deprecations": [
            {
                "msg": "Param 'provider' is deprecated. See the module docs for more information",
                "version": 2.14
            }
        ],
        "diff": {
            "prepared": "[edit system syslog host 192.168.100.70]\n+     interactive-commands any;\n[edit system syslog host 192.168.100.70]\n+    facility-override local1;\n+    log-prefix firewall;\n+    source-address 172.16.203.121;\n+    explicit-priority;\n[edit system syslog]\n+    file messages {\n+        any critical;\n+        authorization info;\n+    }\n+    file default-log-messages {\n+        structured-data;\n+    }\n+    file sessions {\n+        user info;\n+    }\n+    file interactive-commands {\n+        interactive-commands error;\n+    }"
        },
        "failed": false
    }
}

TASK [success] *********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:18
skipping: [172.16.203.121] => {}

TASK [failed] **********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:23
ok: [172.16.203.121] => {
    "msg": "Syslog server check - This check has failed with the following output({'changed': True, 'diff': {'prepared': '[edit system syslog host 192.168.100.70]\\n+     interactive-commands any;\\n[edit system syslog host 192.168.100.70]\\n+    facility-override local1;\\n+    log-prefix firewall;\\n+    source-address 172.16.203.121;\\n+    explicit-priority;\\n[edit system syslog]\\n+    file messages {\\n+        any critical;\\n+        authorization info;\\n+    }\\n+    file default-log-messages {\\n+        structured-data;\\n+    }\\n+    file sessions {\\n+        user info;\\n+    }\\n+    file interactive-commands {\\n+        interactive-commands error;\\n+    }'}, 'deprecations': [{'msg': \"Param 'provider' is deprecated. See the module docs for more information\", 'version': 2.14}], 'ansible_facts': {'discovered_interpreter_python': '/usr/libexec/platform-python'}, 'failed': False})"
}

TASK [Admin credentials check] *****************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:29
<172.16.203.121> using connection plugin netconf (was local)
<172.16.203.121> identified ncclient device handler: junos.
<172.16.203.121> ESTABLISH NETCONF SSH CONNECTION FOR USER: root on PORT 830 TO 172.16.203.121 WITH SSH_CONFIG = None
<172.16.203.121> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.16.203.121> EXEC /bin/sh -c 'echo ~root && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432 && echo ansible-tmp-1592490550.3698227-52363-198623359777432="` echo /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py
<172.16.203.121> PUT /root/.ansible/tmp/ansible-local-52311nkl6r8cg/tmprdv_25dz TO /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432/AnsiballZ_junos_config.py
<172.16.203.121> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432/ /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/usr/libexec/platform-python /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592490550.3698227-52363-198623359777432/ > /dev/null 2>&1 && sleep 0'
ok: [172.16.203.121] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backup": false,
            "backup_options": null,
            "check_commit": false,
            "comment": "Ensure that Admin user havee been created",
            "confirm": 0,
            "confirm_commit": false,
            "lines": null,
            "provider": {
                "host": null,
                "password": null,
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "netconf",
                "username": null
            },
            "replace": null,
            "rollback": null,
            "src": "set system login user admin uid 101\nset system login user admin class super-user\nset system login user admin authentication encrypted-password $1$mysecret$AAg03pXKlOZeFEr//KrxT.\n",
            "src_format": null,
            "update": "merge",
            "zeroize": false
        }
    }
}

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:35
ok: [172.16.203.121] => {
    "junos_output": {
        "changed": false,
        "deprecations": [
            {
                "msg": "Param 'provider' is deprecated. See the module docs for more information",
                "version": 2.14
            }
        ],
        "failed": false
    }
}

TASK [success] *********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:38
ok: [172.16.203.121] => {
    "msg": "Admin credentials check - This check has passed with the following output({'changed': False, 'deprecations': [{'msg': \"Param 'provider' is deprecated. See the module docs for more information\", 'version': 2.14}], 'failed': False})"
}

TASK [failed] **********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:43
skipping: [172.16.203.121] => {}

TASK [NTP Server check] ************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:49
<172.16.203.121> using connection plugin netconf (was local)
<172.16.203.121> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.16.203.121> EXEC /bin/sh -c 'echo ~root && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396 && echo ansible-tmp-1592490553.474145-52396-186605027168396="` echo /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py
<172.16.203.121> PUT /root/.ansible/tmp/ansible-local-52311nkl6r8cg/tmp3q_9lh0r TO /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396/AnsiballZ_junos_config.py
<172.16.203.121> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396/ /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/usr/libexec/platform-python /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592490553.474145-52396-186605027168396/ > /dev/null 2>&1 && sleep 0'
ok: [172.16.203.121] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backup": false,
            "backup_options": null,
            "check_commit": false,
            "comment": "Ensure that correct NTP servers has been configured",
            "confirm": 0,
            "confirm_commit": false,
            "lines": null,
            "provider": {
                "host": null,
                "password": null,
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "netconf",
                "username": null
            },
            "replace": null,
            "rollback": null,
            "src": "set system ntp server 1.1.1.1 key 12                   \nset system ntp server 1.1.1.2\nset system ntp server 1.1.1.3 key 16\nset system ntp server 1.1.1.4 key 15\nset system ntp server 1.1.1.3 prefer\n",
            "src_format": null,
            "update": "merge",
            "zeroize": false
        }
    }
}

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:55
ok: [172.16.203.121] => {
    "junos_output": {
        "changed": false,
        "deprecations": [
            {
                "msg": "Param 'provider' is deprecated. See the module docs for more information",
                "version": 2.14
            }
        ],
        "failed": false
    }
}

TASK [success] *********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:58
ok: [172.16.203.121] => {
    "msg": "NTP Server check  - This check has passed with the following output({'changed': False, 'deprecations': [{'msg': \"Param 'provider' is deprecated. See the module docs for more information\", 'version': 2.14}], 'failed': False})"
}

TASK [failed] **********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:63
skipping: [172.16.203.121] => {}

TASK [Idle timeout check] **********************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:69
<172.16.203.121> using connection plugin netconf (was local)
<172.16.203.121> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.16.203.121> EXEC /bin/sh -c 'echo ~root && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168 && echo ansible-tmp-1592490556.5086114-52427-253553669053168="` echo /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py
<172.16.203.121> PUT /root/.ansible/tmp/ansible-local-52311nkl6r8cg/tmpqjpcrunk TO /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168/AnsiballZ_junos_config.py
<172.16.203.121> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168/ /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/usr/libexec/platform-python /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168/AnsiballZ_junos_config.py && sleep 0'
<172.16.203.121> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592490556.5086114-52427-253553669053168/ > /dev/null 2>&1 && sleep 0'
ok: [172.16.203.121] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backup": false,
            "backup_options": null,
            "check_commit": false,
            "comment": "Ensure that idle timeout has been configured",
            "confirm": 0,
            "confirm_commit": false,
            "lines": null,
            "provider": {
                "host": null,
                "password": null,
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "netconf",
                "username": null
            },
            "replace": null,
            "rollback": null,
            "src": "set system login class super-user-local idle-timeout 10\n",
            "src_format": null,
            "update": "merge",
            "zeroize": false
        }
    }
}

TASK [debug] ***********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:75
ok: [172.16.203.121] => {
    "junos_output": {
        "changed": false,
        "deprecations": [
            {
                "msg": "Param 'provider' is deprecated. See the module docs for more information",
                "version": 2.14
            }
        ],
        "failed": false
    }
}

TASK [success] *********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:78
ok: [172.16.203.121] => {
    "msg": "Idle timeout check   - This check has passed with the following output({'changed': False, 'deprecations': [{'msg': \"Param 'provider' is deprecated. See the module docs for more information\", 'version': 2.14}], 'failed': False})"
}

TASK [failed] **********************************************************************************************************************************************
task path: /home/gefelas/ansible_junos/junos_config_new.yml:83
skipping: [172.16.203.121] => {}
META: ran handlers
META: ran handlers

PLAY RECAP *************************************************************************************************************************************************
172.16.203.121             : ok=13   changed=1    unreachable=0    failed=0    skipped=4    rescued=0    ignored=0   

What do I have to do to displayed the output in a human readable format
How do I get it to remove the extra spaces ( \n \n+ ) and text and get it to look like this ( human readable) below ?

set system syslog host 192.168.100.70 interactive-commands any
set system syslog host 192.168.100.70 facility-override local1
set system syslog host 192.168.100.70 log-prefix firewall
set system syslog host 192.168.100.70 source-address 172.16.203.121
set system syslog host 192.168.100.70 explicit-priority
set system syslog file messages any critical
set system syslog file messages authorization info

I have tried using these examples in the past

https://serverfault.com/questions/640130/display-output-with-ansible
https://stackoverflow.com/questions/34188167/ansible-print-message-debug-msg-line1-n-var2-n-line3-with-var3

[Junos]: gathered operation doesn't work with junos_interfaces resource module

SUMMARY

gathered operation for junos_interfaces resource module resulting in traceback

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_interfaces

ANSIBLE VERSION
ansible 2.10.0.dev0
CONFIGURATION
ansible_network_os=junipernetworks.junos.junos
ansible_connection=ansible.netcommon.netconf
OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- name: Merged Operation
  hosts: junos-rdo
  collections:
    - junipernetworks.junos
  tasks:
    - name: "gather facts for junos interfaces"
      junipernetworks.junos.junos_interfaces:
        state: gathered
EXPECTED RESULTS

interfaces resource module facts gathered from device.

ACTUAL RESULTS

The full traceback is:
Traceback (most recent call last):
File "/home/rothakur/.ansible/tmp/ansible-local-370476z6_mjbou/ansible-tmp-1596554584.166721-118950778795786/AnsiballZ_junos_interfaces.py", line 102, in
_ansiballz_main()
File "/home/rothakur/.ansible/tmp/ansible-local-370476z6_mjbou/ansible-tmp-1596554584.166721-118950778795786/AnsiballZ_junos_interfaces.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/rothakur/.ansible/tmp/ansible-local-370476z6_mjbou/ansible-tmp-1596554584.166721-118950778795786/AnsiballZ_junos_interfaces.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_interfaces', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib64/python3.8/runpy.py", line 206, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.8/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib64/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_junipernetworks.junos.junos_interfaces_payload_t7w9eg8g/ansible_junipernetworks.junos.junos_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py", line 344, in
File "/tmp/ansible_junipernetworks.junos.junos_interfaces_payload_t7w9eg8g/ansible_junipernetworks.junos.junos_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py", line 339, in main
File "/tmp/ansible_junipernetworks.junos.junos_interfaces_payload_t7w9eg8g/ansible_junipernetworks.junos.junos_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py", line 76, in execute_module
File "/tmp/ansible_junipernetworks.junos.junos_interfaces_payload_t7w9eg8g/ansible_junipernetworks.junos.junos_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py", line 116, in set_config
File "/tmp/ansible_junipernetworks.junos.junos_interfaces_payload_t7w9eg8g/ansible_junipernetworks.junos.junos_interfaces_payload.zip/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py", line 139, in set_state
UnboundLocalError: local variable 'config_xmls' referenced before assignment

Issue in the gathered output of junipernetworks.junos.junos_l3_interfaces

SUMMARY

when use gathered in junipernetworks.junos.junos_l3_interfaces, the output only shows the first unit number of the interface and all IP addresses on other units shows under the first interface unit.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_l3_interfaces

ANSIBLE VERSION
ansible 2.10.2
JUNOS 18.4R3-S4.2 built 2020-06-25, JUNOS: 18.3R1.9
STEPS TO REPRODUCE
EXPECTED RESULTS

Many IPs below in actual results are actually under other unit numbers, but they are displayed under unit 0. The other unit numbers does not show in the gathered output. This behavior seems happen on all interfaces that have more than one units.

ACTUAL RESULTS

-   ipv4:
    -   address: 10.0.1.1/32
    - {}
    -   address: 10.140.90.32/32
    -   address: 10.0.1.30/32
    -   address: 11.11.11.11/32
    -   address: 12.12.12.12/32
    -   address: 13.13.13.13/32
    -   address: 14.14.14.14/32
    -   address: 15.15.15.15/32
    -   address: 16.16.16.16/32
    -   address: 17.17.17.17/32
    -   address: 18.18.18.18/32
    -   address: 10.20.0.3/32
    -   address: 10.50.50.50/32
    -   address: 10.50.50.50/32
    -   address: 10.30.0.3/32
    -   address: 10.30.30.30/32
    -   address: 192.168.200.100/32
    -   address: 10.0.100.1/32
    -   address: 10.0.150.1/32
    -   address: 10.0.200.1/32
    -   address: 10.200.0.1/32
    -   address: 10.201.0.1/32
    name: lo0
    unit: '0'


Add new states to RM

Add new states to junipernetwork.junos RM

Add gathered state to the following modules
  • junos_ospfv2
  • junos_vlans
  • junos_acls
  • junos_acl_interfaces
  • junos_static_routes
  • junos_interfaces
  • junos_l3_interfaces
  • junos_l2_interfaces
  • junos_lacp
  • junos_lacp_interfaces
  • junos_lldp_interfaces
  • junos_lldp_global
  • junos_lag_interfaces

junos_config replace not working as expected

SUMMARY

What I understand from update: replace is that the whole hierarchy level gets replaced by one that the user defines.
However it seems in my test scenarios replace acts the same as merge.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_config

ANSIBLE VERSION
ansible 2.10.7
CONFIGURATION

OS / ENVIRONMENT

Target machine version: Junos: 18.4R2-S5.4

STEPS TO REPRODUCE
- name: Configure device
  hosts: junos01
  gather_facts: no
  connection: ansible.netcommon.netconf
  tasks:
  - name: load configure file into device
    junipernetworks.junos.junos_config:
      src: ../../configuration/test.conf
      update: replace
EXPECTED RESULTS
# before
user@junos1> show configuration interfaces
ge-0/0/1 {
    description "Connection 1";
}
ge-0/0/2 {
    description "Connection 2";
}
vme {
    unit 0 {
        family inet {
            dhcp;
        }
    }
}

Running junos_config module with the following config:

# test.conf
interfaces {
    ge-0/0/1 {
        description "Connection 1";
    }
    vme {
        unit 0 {
            family inet {
                dhcp;
            }
        }
    }
}

I expect to see the following result, ge-0/0/2 removed as that isn't in the interface hierachy anymore.

# after
user@junos1> show configuration interfaces
ge-0/0/1 {
    description "Connection 1";
}
vme {
    unit 0 {
        family inet {
            dhcp;
        }
    }
}
ACTUAL RESULTS

However in actuality what I get is

user@junos1> show configuration interfaces
ge-0/0/1 {
    description "Connection 1";
}
ge-0/0/2 {
    description "Connection 2";
}
vme {
    unit 0 {
        family inet {
            dhcp;
        }
    }
}

[Junos] unwanted description attribute in l3_interfaces facts and gathered operation results in traceback

SUMMARY
ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_l3_interfaces

ANSIBLE VERSION
ansible 2.10.0.dev0
CONFIGURATION
ansible_network_os=junipernetworks.junos.junos
ansible_connection=ansible.netcommon.netconf
OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: "gather facts for junos layer 3 interfaces"
      junipernetworks.junos.junos_l3_interfaces:
        state: gathered
EXPECTED RESULTS
ACTUAL RESULTS
"gathered": [
        {

        {
            "description": "ANSIBLE",
            "ipv4": [
                {
                    "address": "10.8.38.38/24"
                }
            ],
            "name": "fxp0",
            "unit": "0"
        }
    ]

Check for missing commits vs devel

SUMMARY

The "Big Migration" has now taken place.

As this collection already exists, we need to carefully check to see if any further commits went into devel since this repo was created.

Please check the contents of https://github.com/ansible-collection-migration/junipernetworks.junos against this repo

In particular:

  • Please do a per-file level diff against every file in the ansible-collection-migration repo and this one
  • Pay care to files added and removed.
  • During the last two weeks there have been lots of fixes, especially around and tests, dependencies, and new collection features e.g. meta/action_groups.yml
ISSUE TYPE
  • Bug Report

get an empty conf file from JUNOS 9.5R3.7

SUMMARY

when I run show configuration command on a machine which os is JUNOS 9.5R3.7, I can get many configurations,
but when I use playbook like below,I get an empty backup file, How Can I get the configurations correctly,or how to find the reason?and there is no error when I run the playbook, connection: local is not be supported or JUNOS 9.5R3.7 is not be supported?

---
- hosts: juniper
  connection: local
  tasks:
    - name: Backup current switch config (junos)
      junipernetworks.junos.junos_config:
        backup: yes
      register: backup_junos_location     
    - name: Print response
      debug:
        var: backup_junos_location 
ISSUE TYPE
  • Documentation Report
COMPONENT NAME

junipernetworks.junos.junos_config:

ANSIBLE VERSION
ansible 2.10.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home1/irteam/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/python3/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.0 (default, Nov 25 2020, 12:19:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

Unsupported parameters for (junipernetworks.junos.junos_interfaces) module: provider Supported parameters include: config, running_config, state"

SUMMARY

I'm trying to use the junipernetworks.junos.junos_interfaces module in my playbook, but have been rather unsuccessful. When I first tried running it, I got unknown command: /bin/sh\r. According to this guide, I should add connection: local to the playbook. After doing that, however, I got the following error:

fatal: [junos_test]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "config": [
                {
                    "description": "HELLO WORLD",
                    "name": "ge-0/0/1"
                }
            ],
            "provider": {
                "host": null,
                "password": null,
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "netconf",
                "username": null
            }
        }
    },
    "msg": "Unsupported parameters for (junipernetworks.junos.junos_interfaces) module: provider Supported parameters include: config, running_config, state"
}

It seems a whole new 'provider' object is being added to the 'module_args', which is what's causing the error, but what's weird is that I never include such parameters. Here is what the playbook looks like:

---
- name: Update description of an interface.
  hosts: junos_test
  connection: local
  vars_prompt:
    - name: description
      prompt: Enter a new description
      private: no
  tasks:
    - name: "Update the description of an interface"
      junipernetworks.junos.junos_interfaces:
        config:
          - name: ge-0/0/1
            description: "{{ description }}"
ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_interfaces

ANSIBLE VERSION
ansible 2.10.5
  config file = None
  configured module search path = ['/Users/lenny/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/2.10.6/libexec/lib/python3.9/site-packages/ansible
  executable location = /opt/homebrew/bin/ansible
  python version = 3.9.1 (default, Feb  2 2021, 22:54:59) [Clang 12.0.0 (clang-1200.0.32.29)]
CONFIGURATION
OS / ENVIRONMENT

Host: iOS Big Sur 11.1 (M1 chip)
Target: Junos 12.3R12-S15

STEPS TO REPRODUCE

Run the playbook below:

---
- name: Update description of an interface.
  hosts: junos_test
  connection: local
  vars_prompt:
    - name: description
      prompt: Enter a new description
      private: no
  tasks:
    - name: "Update the description of an interface"
      junipernetworks.junos.junos_interfaces:
        config:
          - name: ge-0/0/1
            description: "{{ description }}"
EXPECTED RESULTS

The description of the interface named 'ge-0/0/1' would have updated to match the user's input (HELLO WORLD).

ACTUAL RESULTS
ansible-playbook 2.10.5
  config file = None
  configured module search path = ['/Users/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/2.10.6/libexec/lib/python3.9/site-packages/ansible
  executable location = /opt/homebrew/bin/ansible-playbook
  python version = 3.9.1 (default, Feb  2 2021, 22:54:59) [Clang 12.0.0 (clang-1200.0.32.29)]
No config file found; using defaults
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
redirecting (type: action) junipernetworks.junos.junos_interfaces to junipernetworks.junos.junos
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: update_description.yml ***********************************************
1 plays in update_description.yml
Enter a new description: 
PLAY [Update description of an interface.] *************************************

TASK [Gathering Facts] *********************************************************
task path: /Users/USER/Projects/ansible/playbooks/update_description.yml:2
<10.33.197.22> ESTABLISH LOCAL CONNECTION FOR USER: USER
<10.33.197.22> EXEC /bin/sh -c 'echo ~USER && sleep 0'
<10.33.197.22> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/USER/.ansible/tmp `"&& mkdir "` echo /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200 `" && echo ansible-tmp-1612907932.953898-78092-209629997805200="` echo /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200 `" ) && sleep 0'
<junos_test> Attempting python interpreter discovery
<10.33.197.22> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<junos_test> Python interpreter discovery fallback (unsupported platform for extended discovery: darwin)
Using module file /opt/homebrew/Cellar/ansible/2.10.6/libexec/lib/python3.9/site-packages/ansible/modules/setup.py
<10.33.197.22> PUT /Users/USER/.ansible/tmp/ansible-local-780809biusuyu/tmpagkp2r42 TO /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200/AnsiballZ_setup.py
<10.33.197.22> EXEC /bin/sh -c 'chmod u+x /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200/ /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200/AnsiballZ_setup.py && sleep 0'
<10.33.197.22> EXEC /bin/sh -c '/usr/bin/python /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200/AnsiballZ_setup.py && sleep 0'
<10.33.197.22> EXEC /bin/sh -c 'rm -f -r /Users/USER/.ansible/tmp/ansible-tmp-1612907932.953898-78092-209629997805200/ > /dev/null 2>&1 && sleep 0'
ok: [junos_test]
META: ran handlers
redirecting (type: action) junipernetworks.junos.junos_interfaces to junipernetworks.junos.junos

TASK [Update the description of an interface] **********************************
task path: /Users/USER/Projects/ansible/playbooks/update_description.yml:9
redirecting (type: action) junipernetworks.junos.junos_interfaces to junipernetworks.junos.junos
redirecting (type: action) junipernetworks.junos.junos_interfaces to junipernetworks.junos.junos
<10.33.197.22> using connection plugin ansible.netcommon.netconf (was local)
<10.33.197.22> ESTABLISH LOCAL CONNECTION FOR USER: USER
<10.33.197.22> EXEC /bin/sh -c 'echo ~USER && sleep 0'
<10.33.197.22> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/USER/.ansible/tmp `"&& mkdir "` echo /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399 `" && echo ansible-tmp-1612907934.216861-78130-166860396035399="` echo /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399 `" ) && sleep 0'
Using module file /opt/homebrew/Cellar/ansible/2.10.6/libexec/lib/python3.9/site-packages/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py
<10.33.197.22> PUT /Users/USER/.ansible/tmp/ansible-local-780809biusuyu/tmp33amwwnl TO /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399/AnsiballZ_junos_interfaces.py
<10.33.197.22> EXEC /bin/sh -c 'chmod u+x /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399/ /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399/AnsiballZ_junos_interfaces.py && sleep 0'
<10.33.197.22> EXEC /bin/sh -c '/usr/bin/python /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399/AnsiballZ_junos_interfaces.py && sleep 0'
<10.33.197.22> EXEC /bin/sh -c 'rm -f -r /Users/USER/.ansible/tmp/ansible-tmp-1612907934.216861-78130-166860396035399/ > /dev/null 2>&1 && sleep 0'
fatal: [junos_test]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "config": [
                {
                    "description": "HELLO WORLD",
                    "name": "ge-0/0/1"
                }
            ],
            "provider": {
                "host": null,
                "password": null,
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "netconf",
                "username": null
            }
        }
    },
    "msg": "Unsupported parameters for (junipernetworks.junos.junos_interfaces) module: provider Supported parameters include: config, running_config, state"
}

PLAY RECAP *********************************************************************
junos_test                 : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

no_copy: no for junos_package misleading

Seriously guys? Who came with idea of no_copy: no . I can wrap my head around trying to figure out what to put there, if my image is already copied to device. Those images are huge, I doubt anybody wants to copy image during change window in production.
src parameter is also not helping there. Is it going to work if I put there /var/tmp/jinstallxxxx. What is localized path or full path? Is it local to ansible machine or local to destination juniper router?

Examples are shorten for brewity . You have there 3 examples, practically useless.

Junos_interface is giving syntax based error

SUMMARY

Junos_interface is not working and giving syntax based error

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_interface

ANSIBLE VERSION
  ansible-playbook 2.9.13
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.8.5 (default, Aug 12 2020, 00:00:00) [GCC 10.2.1 20200723 (Red Hat 10.2.1-1)]
CONFIGURATION
DEFAULT_FORKS(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = 10
DEFAULT_GATHERING(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = explicit
DEFAULT_HASH_BEHAVIOUR(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = merge
DEFAULT_HOST_LIST(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = ['/Users/rahkumar/Ansible_Module_Examples/inventory']
DEFAULT_LOG_PATH(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = /Users/rahkumar/.ansible/log/ansible.log
DEFAULT_ROLES_PATH(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = ['/Users/rahkumar/.ansible/roles']
HOST_KEY_CHECKING(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = False
RETRY_FILES_SAVE_PATH(/Users/rahkumar/Ansible_Module_Examples/ansible.cfg) = /Users/rahkumar/.ansible/retry

OS / ENVIRONMENT

Linux

STEPS TO REPRODUCE
    - name: Retrieve facts from devices running Junos OS
      junos_interface:
        name: xe-0/2/1
        enabled: false
EXPECTED RESULTS

It is expected to pass. We tried running individual rpc as seen in netconf trace and it executes fine on the device.

ACTUAL RESULTS
TASK [Disabling switch port] *******************************************************************************************************************************************************************************
task path: /home/lab/juniper_port_down.yml:8
<lab10e-sw02> ESTABLISH LOCAL CONNECTION FOR USER: lab
<lab10e-sw02> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w `"&& mkdir "` echo /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085 `" && echo ansible-tmp-1602684919.813968-31226-42833055793085="` echo /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085 `" ) && sleep 0'
Using module file /home/lab/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py
<lab10e-sw02> PUT /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/tmpmlxu_q7q TO /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/AnsiballZ_junos_interfaces.py
<lab10e-sw02> EXEC /bin/sh -c 'chmod u+x /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/ /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/AnsiballZ_junos_interfaces.py && sleep 0'
<lab10e-sw02> EXEC /bin/sh -c '/usr/bin/python3 /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/AnsiballZ_junos_interfaces.py && sleep 0'
<lab10e-sw02> EXEC /bin/sh -c 'rm -f -r /home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_junipernetworks.junos.junos_interfaces_payload_4q1uw620/ansible_junipernetworks.junos.junos_interfaces_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 91, in parse_rpc_error
File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1896, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1784, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1141, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
File "<string>", line 1
lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/AnsiballZ_junos_interfaces.py", line 102, in <module>
_ansiballz_main()
File "/home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/AnsiballZ_junos_interfaces.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/lab/.ansible/tmp/ansible-local-31220jdy7mg4w/ansible-tmp-1602684919.813968-31226-42833055793085/AnsiballZ_junos_interfaces.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_interfaces', init_globals=None, run_name='__main__', alter_sys=True)
File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code

Cannot Gather Facts with `junos_facts`

SUMMARY

When running the junos_facts module against our inventory, we encounter this error:
AttributeError: 'NoneType' object has no attribute 'text'

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junos_facts

ANSIBLE VERSION
ansible 2.9.6
 config file = /etc/ansible/ansible.cfg
 configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
 ansible python module location = /var/lib/awx/venv/mypy3/lib64/python3.6/site-packages/ansible
 executable location = /var/lib/awx/venv/mypy3/bin/ansible
 python version = 3.6.9 (default, Sep 11 2019, 16:40:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
CONFIGURATION
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/vault_password_file
OS / ENVIRONMENT

Junos 15.1f5 devices

STEPS TO REPRODUCE

Running fact collection through the resource modules will cause this problem:

- name: junos_facts
  junos_facts:
gather_network_resources: ['all']
EXPECTED RESULTS

We should get a return of Ansible Facts for the Junos devices.

ACTUAL RESULTS
TASK [roles/action/get_facts/junos : junos_facts] ******************************
task path: /tmp/awx_2382_ojfvvlq5/project/roles/action/get_facts/junos/tasks/main.yml:2
The full traceback is:
Traceback (most recent call last):
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1588009194.7062397-175641812749303/AnsiballZ_junos_facts.py", line 102, in <module>
    _ansiballz_main()
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1588009194.7062397-175641812749303/AnsiballZ_junos_facts.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1588009194.7062397-175641812749303/AnsiballZ_junos_facts.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.network.junos.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py", line 135, in <module>
  File "/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py", line 126, in main
  File "/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/facts.py", line 62, in get_facts
  File "/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/facts/facts.py", line 105, in get_network_resources_facts
  File "/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py", line 72, in populate_facts
  File "/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py", line 93, in parse_l3_if_resources
AttributeError: 'NoneType' object has no attribute 'text'
fatal: [hostname]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-tmp-1588009194.7062397-175641812749303/AnsiballZ_junos_facts.py\\", line 102, in <module>\\n    _ansiballz_main()\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-tmp-1588009194.7062397-175641812749303/AnsiballZ_junos_facts.py\\", line 94, in _ansiballz_main\\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\\n  File \\"/var/lib/awx/.ansible/tmp/ansible-tmp-1588009194.7062397-175641812749303/AnsiballZ_junos_facts.py\\", line 40, in invoke_module\\n    runpy.run_module(mod_name='ansible.modules.network.junos.junos_facts', init_globals=None, run_name='__main__', alter_sys=True)\\n  File \\"/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py\\", line 205, in run_module\\n    return _run_module_code(code, init_globals, run_name, mod_spec)\\n  File \\"/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py\\", line 96, in _run_module_code\\n    mod_name, mod_spec, pkg_name, script_name)\\n  File \\"/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py\\", line 85, in _run_code\\n    exec(code, run_globals)\\n  File \\"/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py\\", line 135, in <module>\\n  File \\"/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/modules/network/junos/junos_facts.py\\", line 126, in main\\n  File \\"/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/facts.py\\", line 62, in get_facts\\n  File \\"/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/common/facts/facts.py\\", line 105, in get_network_resources_facts\\n  File \\"/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py\\", line 72, in populate_facts\\n  File \\"/tmp/ansible_junos_facts_payload_ihoepdgj/ansible_junos_facts_payload.zip/ansible/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py\\", line 93, in parse_l3_if_resources\\nAttributeError: 'NoneType' object has no attribute 'text'\\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\\nSee stdout/stderr for the exact error",
    "rc": 1
}

feature request: l3_interface option in junos_vlans

SUMMARY

In order to migrate from deprecated module (junos_vlan), l3_interface option should be implemented in new module.

ISSUE TYPE
  • Feature Idea
  l3_interface:
    description:
    - Name of logical layer 3 interface.
    type: str
COMPONENT NAME

junos_vlans.py

ADDITIONAL INFORMATION

Same functionality as in old module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.