F5Networks / f5-ansible-bigip

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

bigip_fast_application: module failure when "state: present" #44

Closed simonkowallik closed 1 year ago

simonkowallik commented 1 year ago
COMPONENT NAME

bigip_fast_application

Environment

ANSIBLE VERSION
ansible --version
ansible [core 2.13.5]
  config file = /ansible/ansible.cfg
  configured module search path = ['/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/site-packages/ansible
  ansible collection location = /ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.6 (main, Aug 23 2022, 08:25:41) [GCC 10.2.1 20210110]
  jinja version = 3.1.2
  libyaml = True

python3 --version
Python 3.10.6
BIGIP VERSION
Product: BIG-IP
Version: 16.1.2.1
Build: 0.0.10
Sequence: 16.1.2.1-0.0.10.0
CONFIGURATION
- name: "FAST declaration"
  set_fact:
    fast_declaration:
      tenant_name: TestTenant
      application_name: TestApp
      virtual_port: 80
      virtual_address: 10.1.2.3
      server_port: 80
      server_addresses:
          - 10.1.2.100
          - 10.1.2.101
  tags:
  - f5-fast-test

- name: "FAST declaration debug"
  debug:
    msg: "{{ fast_declaration }}"
  tags:
  - f5-fast-test

- name: "FAST create"
  f5networks.f5_bigip.bigip_fast_application:
    template: "examples/simple_http"
    application: "{{ fast_declaration.application_name }}"
    tenant: "{{ fast_declaration.tenant_name }}"
    content: "{{ fast_declaration }}"
    state: "create"
  tags:
  - f5-fast-test

- name: "FAST present"
  f5networks.f5_bigip.bigip_fast_application:
    template: "examples/simple_http"
    application: "{{ fast_declaration.application_name }}"
    tenant: "{{ fast_declaration.tenant_name }}"
    content: "{{ fast_declaration }}"
    state: "present"
  tags:
  - f5-fast-test
OS / ENVIRONMENT
SUMMARY

f5networks.f5_bigip.bigip_fast_application module fails with the below error.

TASK [f5fast : FAST present] *******************************************************************************************************************************************************************************************************
task path: /ansible/roles/myrole/tasks/main.yml:61
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
<10.1.1.5> ESTABLISH HTTP(S) CONNECTFOR USER: admin TO https://10.1.1.5:443
fatal: [bigip16]: FAILED! => {
    "changed": false,
    "module_stderr": "list indices must be integers or slices, not str",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"
}
STEPS TO REPRODUCE
use the ansible tasks listed above
EXPECTED RESULTS

No module failure

ACTUAL RESULTS
simonkowallik commented 1 year ago

The error lies in the redundant use of ['message'] within the following function call:

https://github.com/F5Networks/f5-ansible-bigip/blob/49f2b567a71d84346d97223017f2782a53c61674/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_fast_application.py#L390-L392

It should rather state a single ['message'], example below:

https://github.com/F5Networks/f5-ansible-bigip/blob/49f2b567a71d84346d97223017f2782a53c61674/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_fast_application.py#L330-L332

simonkowallik commented 1 year ago

Apparently d5e00a18f38ffb23e3077e861d337e03315111ed fixes the issue.