Forum Discussion

JoshBarrow's avatar
Feb 14, 2022
Solved

Ansible Error: An exception occurred during task execution

Wondering if anyone has seen this type of error using Ansible.

 

Any information would be gladly appreciated!

 

Spoiler
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: split() takes no keyword arguments
fatal: [10.8.246.102]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Trac eback (most recent call last):\n File \"/home/user/.ansible/tmp/ansible-tmp-1644857990.96-17262-103535251865389/AnsiballZ_bigip_virtual_server .py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/user/.ansible/tmp/ansible-tmp-1644857990.96-17262-103535251865389/AnsiballZ _bigip_virtual_server.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/user/.ansib le/tmp/ansible-tmp-1644857990.96-17262-103535251865389/AnsiballZ_bigip_virtual_server.py\", line 40, in invoke_module\n runpy.run_module(mod_na me='ansible_collections.f5networks.f5_modules.plugins.modules.bigip_virtual_server', init_globals=None, run_name='__main__', alter_sys=True)\n Fi le \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server _payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual_server.py\", line 3784, in <module>\n File \"/tmp/ansible_f5 networks.f5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ansible_collections/f5netwo rks/f5_modules/plugins/modules/bigip_virtual_server.py\", line 3777, in main\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_pay load_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual _server.py\", line 3427, in exec_module\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_mod ules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual_server.py\", line 3440, in present\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ans ible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual_server.py\", line 3463, in update\n File \"/tmp/ansible_f5networks.f5_module s.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_modules/plu gins/modules/bigip_virtual_server.py\", line 3471, in should_update\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_payload_HFw5 OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual_server.p y\", line 3501, in _update_changed_options\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_ modules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual_server.py\", line 3078, in compar e\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ ansible_collections/f5networks/f5_modules/plugins/modules/bigip_virtual_server.py\", line 3141, in destination\n File \"/tmp/ansible_f5networks.f 5_modules.bigip_virtual_server_payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_mod ules/plugins/modules/bigip_virtual_server.py\", line 1920, in destination_tuple\n File \"/tmp/ansible_f5networks.f5_modules.bigip_virtual_server_ payload_HFw5OW/ansible_f5networks.f5_modules.bigip_virtual_server_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/ipadd ress.py\", line 84, in compress_address\n # __lt__ and __eq__\nTypeError: split() takes no keyword arguments\n", "module_stdout": "", "msg": "M ODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
  • Problem solved! At least for us. In short, the module in our playbook needs to be executed on the Big-IP itself which uses Python 2.7 and causes the "split()" error. In most cases this can be resolved with "connection: local" or "delegate_to: localhost", as it is with all the F5 Ansible modules. In our case the solution was a bit different, you can check the GitHub issue for explanation.

11 Replies

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      It made it! Thanks for adding the link to the github issue, that will be helpful to others hitting this problem.

  • Problem solved! At least for us. In short, the module in our playbook needs to be executed on the Big-IP itself which uses Python 2.7 and causes the "split()" error. In most cases this can be resolved with "connection: local" or "delegate_to: localhost", as it is with all the F5 Ansible modules. In our case the solution was a bit different, you can check the GitHub issue for explanation.

    • JoshBarrow's avatar
      JoshBarrow
      Icon for Cirrus rankCirrus

      Thank you so much!! the no_f5_teem: True in the provider also fixed it for me!

      I really appreciate it!

    • JoshBarrow's avatar
      JoshBarrow
      Icon for Cirrus rankCirrus

      Awesome Boss! Yea I was checking your post on there. I'll try that out!

  • nice use of the spoiler option! For those that are better versed with ansible errors than I, do you have the (sanitized) playbook you're running that you can share, what version of BIG-IP and what version of python you're using? Thanks...Jason

    • JoshBarrow's avatar
      JoshBarrow
      Icon for Cirrus rankCirrus

      It is running Python Version 3.8 and BIG IP Version 14.1.2.6. 

      Sanitized Playbook here

      Spoiler
      - name: BIG-IP SETUP
        hosts: f5_lab
        connection: local
        gather_facts: false
        ignore_errors: true
        vars_files:
          - varsheet.yml

        tasks:
       # ------------------------ Setup Provider ------------------------  
          - name: Setup provider
            set_fact:
              provider:
                server: "Server"
                user: "{{ansible_user}}"
                password:
                server_port: 443
                validate_certs: false

      # ------------------------ Create New Pool ------------------------
          - name: CREATE POOL
            f5networks.f5_modules.bigip_pool:
              provider: "{{ provider }}"
              name: "{{site_name}}"
              lb_method: "round-robin"
              monitors: "/Common/tcp"

      # ------------------------ Add Pool Members ------------------------  
          - name: ADD POOL MEMBERS
            f5networks.f5_modules.bigip_pool_member:
              provider: "{{ provider }}"
              state: "present"
              address: "{{ item.host }}"
              name: "{{ item.name }}"
              port: "{{ site_port }}"
              pool: "{{site_name}}"
            with_items: "{{pool_members}}"

      # ------------------------ Create Virtual Server ------------------------
          - name: Add virtual server
            f5networks.f5_modules.bigip_virtual_server:
              provider: "{{ provider }}"
              state: present
              partition: Common
              name: "{{site_name}}"
              destination: "{{ virtual_ip }}"
              port: "443"
              pool: "{{site_name}}"
              snat: Automap
              profiles:
                - name: http
                  context: all
                - name: "{{site_name}}"
                  context: server-side
  • Hi all,

    just ran into the same issue, same error, after we switched to ansible 2.12.2 from Ansible 2.10.15

    Ansible version: 2.12.2

    Big-IP version: 15.1.3

    Ansible module: f5networks.f5_modules.bigip_lx_package

    The ansible task:

     

    - name: Install AS3 package.
    f5networks.f5_modules.bigip_lx_package:
    provider: "{{ localprovider }}"
    package: "/var/config/rest/downloads/f5-appsvcs-{{ target_version }}-{{ target_release }}.noarch.rpm"
    retain_package_file: yes
     
    Output:
    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: split() takes no keyword arguments
    fatal: [ap-ae-1-lb114a-02]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 10.246.160.182 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1645427475.1417716-41707-278220905573988/AnsiballZ_bigip_lx_package.py\", line 107, in <module>\r\n _ansiballz_main()\r\n File \"/root/.ansible/tmp/ansible-tmp-1645427475.1417716-41707-278220905573988/AnsiballZ_bigip_lx_package.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/root/.ansible/tmp/ansible-tmp-1645427475.1417716-41707-278220905573988/AnsiballZ_bigip_lx_package.py\", line 48, in invoke_module\r\n run_name='__main__', alter_sys=True)\r\n File \"/usr/lib/python2.7/runpy.py\", line 176, in run_module\r\n fname, loader, pkg_name)\r\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\r\n mod_name, mod_fname, mod_loader, pkg_name)\r\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\r\n exec code in run_globals\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_lx_package.py\", line 505, in <module>\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_lx_package.py\", line 498, in main\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_lx_package.py\", line 226, in exec_module\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 134, in send_teem\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 70, in send\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 45, in prepare_request\r\n File \"/tmp/ansible_f5networks.f5_modules.bigip_lx_package_payload_4cel_G/ansible_f5networks.f5_modules.bigip_lx_package_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 92, in build_telemetry\r\nTypeError: split() takes no keyword arguments\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
    An exception occurred during task execut
    ion. To see the full traceback, use -vvv. The error was: TypeError: split() takes no keyword arguments

    When I switch back to Ansible 2.10.15, everything works fine.