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

Implement replaced, overridden states in the Sonic Network Resource Modules #65

Open
dataolle opened this issue Mar 31, 2022 · 1 comment
Assignees

Comments

@dataolle
Copy link

dataolle commented Mar 31, 2022

SUMMARY

Implement more Network Resource Module states in the sonic network resource modules.
The states are described here: https://docs.ansible.com/ansible/latest/network/user_guide/network_resource_modules.html
Implement replaced, overridden and gathered states for the sonic network resource modules.
Example on how it works in the ansible documentation: https://docs.ansible.com/ansible/latest/network/user_guide/network_resource_modules.html#using-network-resource-modules
See the table on the right for the replaced vs merged outcome.
This will make it possible to have a more declarative style playbooks without a lot of state handling.
Right now the network resource modules will only merge or delete, which means i need to read out existing config for for example vlans, check ansible vars what should be on the switch and the do a set comparison to delete and add vlans as needed.
If the replace method was implemented this complexity would be implemented in the network resource module instead of my playbook or ansible code.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • sonic_vlans
  • sonic_vrfs
  • sonic_vxlans
  • sonic_interfaces
  • sonic_l2_interfaces
  • sonic_l3_interfaces
  • sonic_lag_interfaces
  • etc
ADDITIONAL INFORMATION

It would make it easier to have more declarative ansible playbooks and reduce a lot of complexity when you want device config mirroring ansible device variables. without replace state deletion is added complexity I do not want or need.
Also, this would make these network resource modules more in line with ansible reference documentation and it would be more like feature parity with other network resource module collections.

- name: replaces given VLAN attributes with the device configuration
  dellemc.enterprise_sonic.sonic_vlans:
    config:
      - vlan_id: 10
      - vlan_id: 20
    state: replaced

This would make sure only vlan 10 and vlan 20 is configured and all others are removed.

@kerry-meyer
Copy link
Collaborator

kerry-meyer commented Mar 31, 2022

We agree that this request needs to be addressed and have put it on our list of work items.

Some of our current resource modules do provide functionality beyond "merge" and "delete", but these other states have not been consistently implemented across all of our resource modules.

Implementation of the "replaced" state is at the top of our list for new states to be supported across all resource modules. We will also add implementation of "overidden" state as a high priority.

We are currently adding some new resource modules that are required in order to provide Ansible configuration capability for all of the commonly deployed configuration categories. We intend to provide support for the "replaced" state from the start for these new modules. We will add "replaced" and "overidden" state support to the other resource modules after completing our release of the additional required resource modules.

@kerry-meyer kerry-meyer self-assigned this Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants