F5Networks / f5-ansible

Imperative Ansible modules for F5 BIG-IP products
GNU General Public License v3.0
374 stars 229 forks source link

bigip_ucs_fetch - Traceback on UCS fetch #2388

Open apellini opened 9 months ago

apellini commented 9 months ago
COMPONENT NAME

Environment

ANSIBLE VERSION
ansible [core 2.13.6]
  config file = None
  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

f5networks.f5_modules 1.25.1
BIGIP VERSION
15.1.5.1
16.1.4.1
16.1.3.2
CONFIGURATION
OS / ENVIRONMENT

RHEL 7.9

SUMMARY

UCS Backup not working on some device and traceback not useful to understand the issue

STEPS TO REPRODUCE
- name: Collect UCS
      f5networks.f5_modules.bigip_ucs_fetch:
        provider: "{{ provider }}"
        async_timeout: 1800
        src: "{{ ucs_file }}"
        dest: "{{ tmp }}/{{ ucs_file }}"
      delegate_to: localhost
      register: ucs_status
      ignore_errors: true
      environment:
        http_proxy: ""
        https_proxy: ""
EXPECTED RESULTS

Backup performed

ACTUAL RESULTS
fatal: [hostname -> localhost]: FAILED! => {"changed": false, "msg": "Expecting value: line 1 column 1 (char 0)"}
pgouband commented 8 months ago

Hi @apellini,

I tested the following playbook with version 16.1.3.2 without any issue so it's maybe something in your environment.

- hosts: all
  collections:
    - f5networks.f5_modules
  connection: local

  tasks:
     - name: create new UCS in Big-IP device
       f5networks.f5_modules.bigip_ucs_fetch:
         provider:
           server: "X.X.X.X"
           user: "admin"
           password: "mysecret"
           server_port: 443
           validate_certs: no
           no_f5_teem: yes
         src: "bigip16.1.3.2.ucs"
         dest: "/var/tmp/bigip16.1.3.2.ucs"
         async_timeout: 300
       delegate_to: localhost
apellini commented 8 months ago

I have done some test with verbose:

TASK [Collect UCS] *************************************************************************************************************************************************************************************************
task path: /dsfds/NetDevOps/f5_utils/ansible/backup_f5/testing_backup.yml:150
The full traceback is:
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 755, in main
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 338, in exec_module
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 375, in exec_module
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 389, in present
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 449, in create
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 457, in create_on_device
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 527, in async_wait
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 670, in exists
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 662, in read_current
  File "/tmp/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload_6__uto5p/ansible_f5networks.f5_modules.bigip_ucs_fetch_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_ucs_fetch.py", line 651, in read_current_from_device
fatal: [device-> localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "async_timeout": 1800,
            "attributes": null,
            "backup": false,
            "create_on_missing": true,
            "dest": "tmp/device_2023121218121702402181.ucs",
            "encryption_password": null,
            "fail_on_missing": false,
            "force": true,
            "group": null,
            "mode": null,
            "only_create_file": false,
            "owner": null,
            "provider": {
                "auth_provider": null,
                "no_f5_teem": null,
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "server": "IP",
                "server_port": 443,
                "timeout": null,
                "transport": "rest",
                "user": "user",
                "validate_certs": false
            },
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "device_2023121218121702402181.ucs",
            "unsafe_writes": false
        }
    },
    "msg": "Expecting value: line 1 column 1 (char 0)"
}
...ignoring

What we could see that UCS is created because on next task remove it from device:

TASK [Remove UCS] **************************************************************************************************************************************************************************************************
task path: /dir/NetDevOps/f5_utils/ansible/backup_f5/testing_backup.yml:163
changed: [device -> localhost] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "force": false,
            "include_chassis_level_config": null,
            "no_license": null,
            "no_platform_check": null,
            "passphrase": null,
            "provider": {
                "auth_provider": null,
                "no_f5_teem": null,
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "server": "IP",
                "server_port": 443,
                "timeout": null,
                "transport": "rest",
                "user": "user",
                "validate_certs": false
            },
            "reset_trust": null,
            "state": "absent",
            "ucs": "device_2023121218121702402181.ucs"
        }
    }
}
pgouband commented 8 months ago

Hi @apellini,

Have you tested with the playbook I provided? Also are you sure dest is a full path?

apellini commented 8 months ago

Yes. I have launched two times and has worked. We have a strange behaviour with async_timeout at 300 sec, the first time has taken 294 sec and second 632 sec. I was expecting that when 300 sec is reached task gone in failed.

Also consider that we are using 1800 sec as async_timeout because it is needed from other F5.

pgouband commented 8 months ago

Hi @apellini,

Async_timeout is only for ucs creation not the task. Am I understanding you are able to generate a ucs correctly?

apellini commented 8 months ago

yes but why if I put 1800 sec doesn't work?

pgouband commented 8 months ago

Hi @apellini,

I did the test with 1800 and I have no issue so it's maybe something related to your environment.

apellini commented 8 months ago

But the strangest thing if I put 1800 it fails after 24 min not 30.

TASK [Collect UCS] ***** fatal: [device -> localhost]: FAILED! => {"changed": false, "msg": "Expecting value: line 1 column 1 (char 0)"} ...ignoring Wednesday 13 December 2023 13:57:56 +0100 (0:24:04.306) 0:24:33.799 ****

pgouband commented 8 months ago

Hi @apellini,

Best way to go forward, will be to do a repro with your ucs configuration so you need to open a case via https://my.f5.com