aristanetworks / ansible-cvp

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

Feat(cv_device_v3): Report ignore missing devices #669

Closed sugetha24 closed 4 months ago

sugetha24 commented 10 months ago

Enhancement summary

cv_device_v3 has a new knob to ignore devices missing from the inventory by setting inventory_mode: loose. But, we don't report back to the user what devices were ignored. We want to add a way to report this information back to the user in the Ansible response

Which component of AVD is impacted

cv_device_v3

Use case example

Playbook:

- name: Device Management in CloudVision
  hosts: CloudVision
  connection: local
  gather_facts: false
  collections:
    - arista.cvp
  vars:
    CVP_DEVICES:
      - fqdn: NON-EXISTING-DEVICE
        parentContainerName: ANSIBLE
        configlets:
            - 'CV-EOS-ANSIBLE01'
        imageBundle: leaf_image_bundle
  tasks:
    - name: "Configure devices on {{inventory_hostname}}"
      arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: present
        search_key: fqdn
        inventory_mode: strict

Output:

TASK [Configure devices on CloudVision] **********************************************************************************************************************************************************************************************************************************************************
ok: [CloudVision]

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************************************************
CloudVision                : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

No reporting of the ignored devices

Describe the solution you'd like

We want to report back with the following datastructure:

msg:
  changed: true
  .....
  devices_missing:
    changed: false
    devices_missing_count: 0
    devices_missing_list: []
    diff: {}
    success: false
    taskIds: []
  ....
  failed: false
  success: true
  taskIds:
  - '469'

Describe alternatives you've considered

No response

Additional context

No response

Tasks List

Code of Conduct

github-actions[bot] commented 7 months 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 4 months ago

Nice to have - Closing for now.