nutanix / nutanix.ansible

Official Nutanix Ansible collections
GNU General Public License v3.0
64 stars 36 forks source link

[Bug] Purpose field mandatory to update the security policy from Ansible in module ntnx_security_rules #485

Open atlasblue opened 3 months ago

atlasblue commented 3 months ago

Encountering a problem when creating Security Rules with Flow using the ntnx_security_rules module provided by the Ansible collection. It is currently not possible to define the Purpose parameter of the security Rule in the script. In the GUI, this parameter corresponds to the Purpose field and this is a mandatory field to update the security policy from Ansible. Without this parameter it's not possible to modify the rest of the Security Rule.

konstruktoid commented 3 months ago

This there's alot of changes to be made regarding the security rules.

https://github.com/nutanix/nutanix.ansible/blob/main/plugins/modules/ntnx_security_rules.py:

  tasks:
    - name: Create app security rule
      nutanix.ncp.ntnx_security_rules:
        name: test_app_rule
        allow_ipv6_traffic: true
        policy_hitlog: true
        app_rule:
          policy_mode: MONITOR
[...]
{
    "msg": {
        "changed": false,
        "error": null,
        "failed": false,
        "response": {
            "api_version": "3.1",
            "code": 410,
            "kind": "network_security_rule",
            "message_list": [
                {
                    "message": "The network security rule APIs are no longer supported. Please use the network security policy APIs instead. Refer to the Nutanix API documentation for additional details.",
                    "reason": "GONE_ERROR"
                }
            ],
            "state": "ERROR"
        }
    }
}