ansible-collection-netscaleradc icon indicating copy to clipboard operation
ansible-collection-netscaleradc copied to clipboard

citrix_adc_nitro_request with get_filtered - only the first filter is applied

Open Belabacsi opened this issue 3 years ago • 0 comments

Dear Developers! Dear GitHub Community!

I would like to ask for a little support regarding the citrix_adc_nitro_request Ansible module when get_filtered operation is used. I have been trying to run the following code with Ansible:

      - name: "Test"
        citrix.adc.citrix_adc_nitro_request:
            nsip: "{{ nsip }}"
            nitro_protocol: "{{ nitro_protocol }}"
            validate_certs: "{{ validate_certs }}"
            nitro_user: "{{ nitro_username }}"
            nitro_pass: "{{ nitro_password }}"

            operation: get_filtered
            resource: service

            filter:
                servername: "{{ prefix_nsapp_lb_server }}{{ item.servername }}"
                servicetype: "{{ item.servicetype }}"
                port: "{{ item.port }}"

        loop: "{{ datavar_config_nsapp_lb_service_name_prefixed }}"
        register: get_filtered_nsapp_lb_service_result

While running the code, I can see the following in debug output:

        "url": "https://nsvpx-1-sdn-oe1-core-dev.netlab.net/nitro/v1/config/service?filter=servername:LBSRV_SRV-1",
        },
        "invocation": {
            "module_args": {
                "expected_nitro_errorcode": [
                    0
                ],
                "filter": {
                    "port": "5201",
                    "servername": "LBSRV_SRV-1",
                    "servicetype": "TCP"
                },

Based on this, it seems, the citrix_adc_nitro_request module applies only the first filter in the API URL, so the URL contains the filter=servername:LBSRV_SRV-1 string only.

When trying to use the expected URL in a browser, I can see the expected output.

/nitro/v1/config/service?filter=servername:LBSRV_SRV-1,servicetype:TCP,port:5201

Please find below my environment details:

$ ansible --version
ansible [core 2.12.4]
  config file = /home/ansible/.ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ansible/ansible/bin/ansible
  python version = 3.9.7 (default, Sep 21 2021, 00:13:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
  jinja version = 3.0.3
  libyaml = True

Does anybody have the same experience with this?

Thank You very much in advance for the support and help!

Update 1

When using the old community.network.netscaler_nitro_request module, it works as expected, so it seems the mentioned problem affects only the citrix_adc_nitro_request module.

Belabacsi avatar Apr 28 '22 08:04 Belabacsi