aristanetworks / ansible-cvp

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

Issue with cv_device_v3.py when pushing an existing configlet with some changes #373

Closed gmoisio closed 3 years ago

gmoisio commented 3 years ago

Hi all, we use cv_configlet_v3.py to push configlets on CVP. When we use cv_device_v3.py to link configlets and devices, it returns a summary of the tasks that have been created on CVP and we can use this result to run tasks with cv_task_v3.py. If the configlet already exists on CVP and we push a new version with some changes, CVP applies the changes on the configlet and create a new task, but cv_devices_v3.py returns an empty information and we cannot have the taskIDs with the returned informations:

{
    "cvp_apply_configlet": {
        "changed": false,
        "configlets_attached": {
            "changed": false,
            "configlets_attached_count": 0,
            "configlets_attached_list": [],
            "diff": {},
            "success": false,
            "taskIds": []
        },
        "configlets_detached": {
            "changed": false,
            "configlets_detached_count": 0,
            "configlets_detached_list": [],
            "diff": {},
            "success": false,
            "taskIds": []
        },
        "devices_deployed": {
            "changed": false,
            "devices_deployed_count": 0,
            "devices_deployed_list": [],
            "diff": {},
            "success": false,
            "taskIds": []
        },
        "devices_moved": {
            "changed": false,
            "devices_moved_count": 0,
            "devices_moved_list": [],
            "diff": {},
            "success": false,
            "taskIds": []
        },
        "failed": false,
        "success": false,
        "taskIds": []
    }
}

When working on this use case, the taskIDs are returned by cv_configlet_v3.py instead of cv_device_v3.py. Is it the desired behavior?

Thanks Regards

titom73 commented 3 years ago

Hello @gmoisio

As per my understanding, you update configlets with arista.cvp.cv_configlet_v3 which creates a task on your Cloudvision and then you run arista.cvp.cv_device_v3 where you expected to get the task generated by previous module ?

In such a situation, because all changes are part of cv_configlet_v3 and not at cv_device_v3 level, the task is generated for the configlet module and returned by CV at that time.

As cv_device_v3 is not sending any update (no change outside of configlet content), there is no API call done to get tasks from Cloudvision by this module.

So yes it is an expected behavior. In your playbook, you can group all tasks into a single variable with additional tasks and run cv_task_v3 only one time.

gmoisio commented 3 years ago

Hi, thank you for your answer. This is what we done. We merge both taskIDs to found those to run. Thanks Regards