F5Networks / f5-ansible-bigip

Declarative Ansible collection for managing F5 BIG-IP/BIG-IQ.
37 stars 17 forks source link

bigip_cfe_deploy - Return unsupported parameter #74

Open apellini opened 10 months ago

apellini commented 10 months ago
COMPONENT NAME

bigip_cfe_deploy

Environment

ANSIBLE VERSION
ansible [core 2.13.6]
  config file = /spimi/NetDevOps/terraform-deploy-f5/postconfig/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.4 (default, Apr 14 2021, 10:57:48) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
  jinja version = 3.1.2
  libyaml = True
BIGIP VERSION
Sys::Version
Main Package
  Product     BIG-IP
  Version     16.1.3.2
  Build       0.0.4
  Edition     Point Release 2
  Date        Wed Sep 14 08:12:07 PDT 2022
SUMMARY

If we use this module we receive: Unsupported parameters for (bigip_cfe_deploy) module: provider. Supported parameters include: content.

STEPS TO REPRODUCE
- name: Configure CFE
  hosts: cfe
  connection: httpapi
  vars:
    ansible_network_os: f5networks.f5_bigip.bigip
    ansible_httpapi_use_ssl: true
  collections:
    - f5networks.f5_bigip
    - ansible.builtin
  tasks:
    - block:
      - name: Pass CFE Declaration
        bigip_cfe_deploy:
          content: "{{ lookup('template', 'cfe.j2') | to_json }}"
      when: cluster_type == "cfe"
EXPECTED RESULTS

Pass CFE Declaration

ACTUAL RESULTS
fatal: [xxxxxxx]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "content": "{\"class\": \"Cloud_Failover\", \"environment\": \"gcp\", \"externalStorage\": {\"scopingName\": \"xxxxxxx\"}, \"controls\": {\"class\": \"Controls\", \"logLevel\": \"info\"}, \"failoverAddresses\": {\"enabled\": true, \"scopingTags\": {\"f5_cloud_failover_label\": \"xxxxxx\"}}, \"failoverRoutes\": {\"enabled\": true, \"routeGroupDefinitions\": [{\"scopingName\": \"xxxxxx\", \"scopingAddressRanges\": [{\"range\": \"yyyyyyy\"}], \"defaultNextHopAddresses\": {\"discoveryType\": \"static\", \"items\": [\"1dddddd\", \"1ddddddd\"]}}]}}",
            "provider": {
                "auth_provider": null,
                "no_f5_teem": null,
                "password": null,
                "server": null,
                "server_port": null,
                "timeout": null,
                "transport": "rest",
                "user": null,
                "validate_certs": null
            }
        }
    },
    "msg": "Unsupported parameters for (bigip_cfe_deploy) module: provider. Supported parameters include: content."
}
pgouband commented 10 months ago

Hi @apellini,

Could you check the output of the file when using "to_json"? Maybe the command is adding extra characters that break JSOn validators like the to_nice_json as indicated here: "If you are using the to_nice_json filter, it will cause this module to fail because the purpose of that filter is to format the JSON to be human-readable and this process includes inserting "extra characters that break JSON validators." https://clouddocs.f5.com/products/orchestration/ansible/devel/f5_bigip/modules_2_0/bigip_cfe_deploy_module.html#bigip-cfe-deploy-module-2

apellini commented 10 months ago

I have checked and also removed to_json but I have same error.

If you see in module_args you find a key called provider but I have never configured.

apellini commented 9 months ago

Hi, I have found the issue.

F5 are associated to two different groups:

f5 cfe

on group f5 I have associated a key called provider with values need to authenticate with idempotent modules.

I have checked hostvars and key is not present when I associate device to cfe group and it works.

I think that this check is needed for something, but I don't understand the why.

pgouband commented 9 months ago

Hi @apellini,

That's a good news.

I'm not sure to understand your last sentence and which check are you referring to?