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 vyos_facts module #138

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

Add available_network_resources key in vyos_facts module #138

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

Comments

@trishnaguha
Copy link

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 vyos_facts module and users can use the vyos_facts module in the same way as they were before.

Current behavior:

---
- name: Fatch facts
  hosts: vyos
  gather_facts: no
  collections:
    - vyos.vyos
  
  tasks:
    - name: Get basic facts 
      vyos_facts:
        gather_subset:
          - '!all'

output

ok: [192.168.6.120] => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default"
        ],
        "ansible_net_hostname": "vyos",
        "ansible_net_model": "VirtualBox",
        "ansible_net_python_version": "3.9.2",
        "ansible_net_serialnum": "0",
        "ansible_net_system": "vyos",
        "ansible_net_version": "VyOS 1.1.8",
        "ansible_network_resources": {},
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "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: vyos
  gather_facts: no
  collections:
    - vyos.vyos
  
  tasks:
    - name: Get the list of avaliable network resources for VyOS and avoid fetching resource facts
      junos_facts:
        gather_subset:
          - '!all'
        available_network_resources: true

Result:

ok: [192.168.56.120] => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default"
        ],
        "ansible_net_hostname": "vyos",
        "ansible_net_model": "VirtualBox",
        "ansible_net_python_version": "3.9.2",
        "ansible_net_serialnum": "0",
        "ansible_net_system": "vyos",
        "ansible_net_version": "VyOS 1.1.8",
        "ansible_network_resources": {},
        "available_network_resources": [
            "bgp_address_family",
            "bgp_global",
            "firewall_global",
            "firewall_interfaces",
            "firewall_rules",
            "interfaces",
            "l3_interfaces",
            "lag_interfaces",
            "lldp_global",
            "lldp_interfaces",
            "ospf_interfaces",
            "ospfv2",
            "ospfv3",
            "static_routes"
        ],
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "available_network_resources": true,
            "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 vyos_facts module Add available_network_resources key in vyos_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.
Development

Successfully merging a pull request may close this issue.

3 participants