ansible-dcnm icon indicating copy to clipboard operation
ansible-dcnm copied to clipboard

`dcnm_policy` deploys wrong policy -switch_freefrom

Open jgomezve opened this issue 2 years ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Ansible Version and collection version

  • ansible [core 2.12.3]

DCNM version

  • 12.1.2e

Affected module(s)

  • dcnm_policy

Ansible Playbook

---
- name: Create a Policy in the  Nexus Dashboard Fabric Controller
  hosts: ndfc
  gather_facts: no
  tasks:

  - name: Create policy including required variables
    cisco.dcnm.dcnm_policy:
      fabric: SIMPL-BROWNFIELD
      config:
        - name: switch_freeform               # This must be a valid template name
          description: TESTING_ANSIBLE
          policy_vars:
            CONF: "ip domain-name at"
        - switch:
            - ip: 1.2.3.4
              name: switch_freeform   
              description: TESTING_ANSIBLE
              policy_vars:
                CONF: "ip domain-name at"

Debug Output

changed: [NDFC-FRA] => {
    "changed": true,
    "diff": [
        {
            "deleted": [],
            "deploy": [
                {
                    "name": "switch_freeform",
                    "serialNo": "FDO2139044J"
                }
            ],
            "merged": [
                {
                    "description": "TESTING_ANSIBLE",
                    "entityName": "SWITCH",
                    "entityType": "SWITCH",
                    "nvPairs": {
                        "CONF": "ip domain-name at"
                    },
                    "priority": 500,
                    "serialNumber": "FDO2139044J",
                    "source": "",
                    "templateName": "switch_freeform"
                }
            ],
            "query": [],
            "skipped": []
        }
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "description": "TESTING_ANSIBLE",
                    "name": "switch_freeform",
                    "policy_vars": {
                        "CONF": "ip domain-name at"
                    }
                },
                {
                    "switch": [
                        {
                            "description": "TESTING_ANSIBLE",
                            "ip": "10.122.18.114",
                            "name": "switch_freeform",
                            "policy_vars": {
                                "CONF": "ip domain-name at"
                            }
                        }
                    ]
                }
            ],
            "deploy": true,
            "fabric": "SIMPL-BROWNFIELD",
            "state": "merged"
        }
    },
    "response": [
        {
            "DATA": {
                "successList": [
                    {
                        "message": "POLICY-261550",
                        "name": "FDO2139044J",
                        "status": "Success"
                    }
                ]
            },
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.12.1.7:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/policies/bulk-create",
            "RETURN_CODE": 200
        },
        {
            "DATA": [
                {
                    "successPTIList": "POLICY-249920",
                    "switchSN": "FDO2139044J"
                }
            ],
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.12.1.7:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/policies/deploy",
            "RETURN_CODE": 200
        }
    ]
}

Note that the policy ID received after creating the policy is the different from the one used to deploy the policy

Expected Behavior

Freeform policy is configured on the NDFC and deployed on the switch

Actual Behavior

Freeform policy is configured on the NDFC but a wrong Policy ID is deployed. Policy in the playbook is not deployed

Steps to Reproduce

Execute the Ansible Playbook

jgomezve avatar Feb 24 '23 22:02 jgomezve

@jgomezve

Thanks for raising the issue. We will look into this and update you

mmudigon avatar Feb 27 '23 05:02 mmudigon