Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add available_network_resources key in junos_facts module #160

Closed
trishnaguha opened this issue Mar 23, 2021 · 0 comments · Fixed by #163
Closed

Add available_network_resources key in junos_facts module #160

trishnaguha opened this issue Mar 23, 2021 · 0 comments · Fixed by #163
Assignees
Labels
feature This issue/PR relates to a feature request. has_pr This issue has an associated PR.
Milestone

Comments

@trishnaguha
Copy link
Member

trishnaguha commented Mar 23, 2021

  • 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
        }
    }
}
@trishnaguha trishnaguha added this to the April'21 milestone Mar 23, 2021
@trishnaguha trishnaguha changed the title Add ansible_network_resources key in junos_facts module Add available_network_resources key in junos_facts module Mar 25, 2021
@rohitthakur2590 rohitthakur2590 added has_pr This issue has an associated PR. feature This issue/PR relates to a feature request. labels Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request. has_pr This issue has an associated PR.
Projects
None yet
2 participants