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 network_resource plugin to manage resource modules #289

Merged

Conversation

ganeshrn
Copy link
Member

@ganeshrn ganeshrn commented Jun 1, 2021

Fixes ansible-collections/ansible.network#13 (part 1)

SUMMARY
  • Add resource_module plugin to manage and provide a single entry point
    for all resource modules for higher oder roles.
  • Example usage
  - name: get list of resource modules for value set by ansible_network_os
    ansible.netcommon.network_resource:
    register: result
  - name: fetch acl config fos cisco.ios.ios
    ansible.netcommon.network_resource:
      name: acls
      state: gathered

  - name: manage acl config
    ansible.netcommon.network_resource:
      name: acls
      config:
        - afi: ipv4
          acls:
            - name: test_acl
              acl_type: extended
              aces:
                - grant: deny
                  protocol_options:
                    tcp:
                      fin: true
                  source:
                    address: 192.0.2.0
                    wildcard_bits: 0.0.0.255
                  destination:
                    address: 192.0.3.0
                    wildcard_bits: 0.0.0.255
                    port_protocol:
                      eq: www
                  option:
                    traceroute: true
                  ttl:
                    eq: 10
      state: merged
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

resource_module

ADDITIONAL INFORMATION

@ganeshrn ganeshrn changed the title Add resource_module plugin to manage resource modules Add network_resource plugin to manage resource modules Jun 1, 2021
@rohitthakur2590
Copy link
Contributor

rohitthakur2590 commented Jun 2, 2021

@ganeshrn This is really awesome!!!
as discussed we can also include some more info in our output as we are able to invoke multiple operations
for multiple collections with this plugin
for example we can observe gathered state output here:

ok: [10.8.38.76] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "gathered": [
        {
            "name": "GigabitEthernet0/0"
        },
        {
            "name": "GigabitEthernet0/1"
        },
        {
            "name": "GigabitEthernet0/2"
        }
    ],
    "invocation": {
        "module_args": {
            "config": null,
            "running_config": null,
            "state": "gathered"
        }
    }
}

Now that we are using the generic plugin, this output doesn't provide much information about :

  • Resource name we just fetched the facts for
  • Connection plugin
  • Network operating system

This is something we could implement either at the individual collection RM level or in this plugin.
What are your thoughts on ^^^ @ganeshrn @cidrblock

@ganeshrn
Copy link
Member Author

ganeshrn commented Jul 1, 2021

recheck

ganeshrn added 5 commits July 2, 2021 08:49
*  Add resource_module plugin to manage and provide single entry point
    for all resource modules for higher oder roles.
* Example usage
```
  - name: get list of resource modules for ansible_network_os
    ansible.netcommon.resource_module:
    register: result
```

```
  - name: fetch acl config fos cisco.ios.ios
    ansible.netcommon.resource_module:
      name: acls
      state: gathered

```

```
  - name: manage acl config
    ansible.netcommon.resource_module:
      name: acls
      config:
        - afi: ipv4
          acls:
            - name: test_acl
              acl_type: extended
              aces:
                - grant: deny
                  protocol_options:
                    tcp:
                      fin: true
                  source:
                    address: 192.0.2.0
                    wildcard_bits: 0.0.0.255
                  destination:
                    address: 192.0.3.0
                    wildcard_bits: 0.0.0.255
                    port_protocol:
                      eq: www
                  option:
                    traceroute: true
                  ttl:
                    eq: 10
      state: merged
```
@ganeshrn ganeshrn force-pushed the action_resource_module branch from 0516a6e to c59a65b Compare July 2, 2021 03:19
@GomathiselviS
Copy link
Contributor

recheck

@ganeshrn
Copy link
Member Author

ganeshrn commented Jul 5, 2021

recheck

@ganeshrn
Copy link
Member Author

ganeshrn commented Jul 6, 2021

arista.eos issue raised for tracking ansible-collections/arista.eos#234

@ganeshrn
Copy link
Member Author

The PR is good to merge for now after CI issues are fixed. The testcase for network_resource will be added as part of PR #305

@ganeshrn
Copy link
Member Author

recheck

1 similar comment
@rohitthakur2590
Copy link
Contributor

recheck

@rohitthakur2590 rohitthakur2590 added the mergeit Gate PR in Zuul CI label Jul 28, 2021
@ganeshrn
Copy link
Member Author

ganeshrn commented Aug 5, 2021

recheck

1 similar comment
@pabelanger
Copy link
Contributor

recheck

Copy link
Contributor

@ansible-zuul ansible-zuul bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rohitthakur2590 rohitthakur2590 removed the mergeit Gate PR in Zuul CI label Aug 11, 2021
@rohitthakur2590
Copy link
Contributor

recheck

3 similar comments
@ganeshrn
Copy link
Member Author

recheck

@rohitthakur2590
Copy link
Contributor

recheck

@GomathiselviS
Copy link
Contributor

recheck

@GomathiselviS
Copy link
Contributor

recheck

@rohitthakur2590 rohitthakur2590 added the blocks_release Ensure this is merged before a release is made label Aug 26, 2021
@rohitthakur2590
Copy link
Contributor

recheck

3 similar comments
@rohitthakur2590
Copy link
Contributor

recheck

@rohitthakur2590
Copy link
Contributor

recheck

@rohitthakur2590
Copy link
Contributor

recheck

@rohitthakur2590 rohitthakur2590 added the mergeit Gate PR in Zuul CI label Aug 27, 2021
@ansible-zuul ansible-zuul bot merged commit 4da2ad8 into ansible-collections:main Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocks_release Ensure this is merged before a release is made mergeit Gate PR in Zuul CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Platform agnostic role ansible.network.resource_manager to manage network resources.
4 participants