aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision
http://cvp.avd.sh
Apache License 2.0
66 stars 61 forks source link

Add `apply_mode: strict` to cvp_tags_v3 #595

Closed chetryan closed 6 months ago

chetryan commented 1 year ago

Enhancement summary

At the moment, there is no way to use cvp_tags_v3 to define the exact tags that are desired on CVP. It is possible to add or delete, but this does not allow for the exact list of tags to be restricted to the ones defined in the input to cvp_tags_v3.

Which component of AVD is impacted

cv_tag_v3

Use case example

- name: cv_tag_v3 example1
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_TAGS:
      - device: leaf1
        device_tags:
          - name: tag1
            value: value1
          - name: tag2
            value: value2
          - name: tag3
            value: value3
        interface_tags:
          - interface: Ethernet1
            tags:
              - name: tag1i
                value: value1i
              - name: tag2i
                value: value2i
          - interface: Ethernet2
            tags:
              - name: tag1i
                value: value1i
              - name: tag2i
                value: value2i
  tasks:
    - name: "create tags"
      arista.cvp.cv_tag_v3:
        tags: "{{CVP_TAGS}}"
        mode: assign
        auto_create: true
        apply_mode: strict

In the above play, we would expect that device leaf1 will only have the tags that were defined under CVP_TAGS:

Describe the solution you'd like

When apply_mode: strict is defined for the cvp_tags_v3 module, the module would ensure that only the tags provided are assigned to the device in CVP. It may have to read existing tags, and delete accordingly in order to ensure this. This behaviour would make it easier to build idempotent playbooks when using this module.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days

sugetha24 commented 6 months ago

Use this feature in arista.avd.deploy_to_cv