Closed ghost closed 1 year ago
app_name: xyzapp1 gslb_domain: gslb.xyz.com app_locations:
@tashafan - We dont support Py27. Please upgrade to Py36 and verify again.
@tashafan the error you are seeing is coming from env that has 2.7 python installed, quite likely you forgot to put delegate_to: localhost in the task and its trying to execute it not on your controller (which seems to have 3.x python installed)
@wojtek0806 Few things to untangle here.
[root@bigip-dc1:Active:Standalone] config # python --version Python 2.7.5
name: Create LTM/GTM Config hosts: localhost gather_facts: false connection: local
collections:
tasks:
As contrast. I am have another environment running legacy python version. Which is able to execute most of the same playbook without adding any additional information. I created the venv with Python3 to meet the requirements of the issue.
Listed below is the ansible version. There are no differences between the earlier config and this one other than that "attempt2" is not utilizing collections and is using an older version of Python and Ansible.. ''' Projects/20220328-xyz/attempt2$ ansible --version ansible 2.9.27 config file = /home/ansible/Projects/20220328-PremiereInc/attempt2/ansible.cfg configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
Here is the playbook output for comparison.
'''
ansible@DESKTOP-OMEQDCT:~/Projects/20220328-PremiereInc/attempt2$ ansible-playbook -i hosts create_app.yaml -e "@app_templates/App1.yaml"
PLAY [Create LTM/GTM Config] *********************************************************************
TASK [include_tasks] *****************************************************************************included: /home/ansible/Projects/20220328-xyz/attempt2/ltm_tasks.yaml for localhost
included: /home/ansible/Projects/20220328-PremiereInc/attempt2/ltm_tasks.yaml for localhost
TASK [Create LTM Pool] ***************************************************************************ok: [localhost]
TASK [Create LTM Pool Members] *******************************************************************ok: [localhost] => (item={u'pr': 10, u'pm': u'10.1.20.101:8001'})
ok: [localhost] => (item={u'pr': 7, u'pm': u'10.1.20.102:8002'})
TASK [Create LTM iRule] **************************************************************************ok: [localhost]
TASK [Create LTM Virtual] ************************************************************************ok: [localhost]
TASK [Create LTM Pool] ***************************************************************************ok: [localhost]
TASK [Create LTM Pool Members] *******************************************************************ok: [localhost] => (item={u'pr': 10, u'pm': u'10.1.120.101:8001'})
ok: [localhost] => (item={u'pr': 7, u'pm': u'10.1.120.102:8002'})
TASK [Create LTM iRule] **************************************************************************ok: [localhost]
TASK [Create LTM Virtual] ************************************************************************ok: [localhost]
TASK [include_tasks] *****************************************************************************included: /home/ansible/Projects/20220328-PremiereInc/attempt2/gtm_tasks.yaml for localhost
TASK [Create GTM Virtual Server] *****************************************************************failed: [localhost] (item={u'datacenter_name': u'Zone1', u'pool_members': [{u'pr': 10, u'pm': u'10.1.20.101:8001'}, {u'pr': 7, u'pm': u'10.1.20.102:8002'}], u'vip_address': u'10.1.10.101:80'}) =>
{"ansible_loop_var": "item", "changed": false, "item": {"datacenter_name": "Zone1", "pool_members": [{"pm": "10.1.20.101:8001", "pr": 10}, {"pm": "10.1.20.102:8002", "pr": 7}], "vip_address": "10.1.10.101:80"}, "msg": "Public URI path not registered: /tm/gtm/server/?Common?Zone1/virtual-servers/"}
failed: [localhost] (item={u'datacenter_name': u'Zone2', u'pool_members': [{u'pr': 10, u'pm': u'10.1.120.101:8001'}, {u'pr': 7, u'pm': u'10.1.120.102:8002'}], u'vip_address': u'10.1.110.101:80'})
=> {"ansible_loop_var": "item", "changed": false, "item": {"datacenter_name": "Zone2", "pool_members": [{"pm": "10.1.120.101:8001", "pr": 10}, {"pm": "10.1.120.102:8002", "pr": 7}], "vip_address": "10.1.110.101:80"}, "msg": "Public URI path not registered: /tm/gtm/server/?Common?Zone2/virtual-servers/"}
PLAY RECAP ***************************************************************************************localhost : ok=11 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
@wojtek0806 It appears that updating the hosts file with the venv path helped. This is what was added to the hosts file localhost ansible_python_interpreter=/home/ansible/venv/20220328-xyz/bin/python
@wojtek0806 They playbook is able to create VIP, Pool, PoolMembers and attach an irule sccessfully. It is tailing while trying to create GTM related tasks. Here is the error.
''' TASK [Create GTM Virtual Server] ***failed: [localhost] (item={'datacenter_name': 'Zone1', 'vip_address': '10.1.10.101:80', 'pool_members': [{'pm': '10.1.20.101:8001', 'pr': 10}, {'pm': '10.1.20.102:8002', 'pr': 7}]}) => {"ansible_loop_var": "item", "changed": false, "item": {"datacenter_name": "Zone1", "pool_members": [{"pm": "10.1.20.101:8001", "pr": 10}, {"pm": "10.1.20.102:8002", "pr": 7}], "vip_address": "10.1.10.101:80"}, "msg": "b'{\"code\":404,\"message\":\"Public URI path not registered: /tm/gtm/server/?Common?Zone1/virtual-servers/\",\"referer\":\"10.1.1.169\",\"restOperationId\":9465621,\"kind\":\":resterrorresponse\"}'"} failed: [localhost] (item={'datacenter_name': 'Zone2', 'vip_address': '10.1.110.101:80', 'pool_members': [{'pm': '10.1.120.101:8001', 'pr': 10}, {'pm': '10.1.120.102:8002', 'pr': 7}]}) => {"ansible_loop_var": "item", "changed": false, "item": {"datacenter_name": "Zone2", "pool_members": [{"pm": "10.1.120.101:8001", "pr": 10}, {"pm": "10.1.120.102:8002", "pr": 7}], "vip_address": "10.1.110.101:80"}, "msg": "b'{\"code\":404,\"message\":\"Public URI path not registered: /tm/gtm/server/?Common?Zone2/virtual-servers/\",\"referer\":\"10.1.1.169\",\"restOperationId\":9465805,\"kind\":\":resterrorresponse\"}'"}
Also, here is the overall output with the -vvvv
'''
(20220328-xyz) ansible@DESKTOP-OMEQDCT:~/venv/20220328-xyz/attempt2/playbooks$ ansible-playbook -i hosts create_app.yaml -e "@app_templates/App1.yaml" -vvvv
ansible-playbook [core 2.12.4]
config file = /home/ansible/venv/20220328-xyz/attempt2/playbooks/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible/venv/20220328-xyz/lib/python3.9/site-packages/ansible
ansible collection location = /home/ansible/venv/20220328-xyz/attempt2/playbooks/collections
executable location = /home/ansible/venv/20220328-xyz/bin/ansible-playbook
python version = 3.9.12 (main, Mar 24 2022, 16:21:12) [GCC 7.5.0]
jinja version = 3.1.1
libyaml = True
Using /home/ansible/venv/20220328-xyz/attempt2/playbooks/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/ansible/venv/20220328-xyz/attempt2/playbooks/hosts as it did not pass its verify_file() method
script declined parsing /home/ansible/venv/20220328-xyz/attempt2/playbooks/hosts as it did not pass its verify_file() method
auto declined parsing /home/ansible/venv/20220328-xyz/attempt2/playbooks/hosts as it did not pass its verify_file() method
Set default localhost to localhost
Parsed /home/ansible/venv/20220328-xyz/attempt2/playbooks/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /home/ansible/venv/20220328-xyz/lib/python3.9/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: create_app.yaml **Positional arguments: create_app.yaml verbosity: 4 connection: smart timeout: 10 become_method: sudo tags: ('all',) inventory: ('/home/ansible/venv/20220328-xyz/attempt2/playbooks/hosts',) extra_vars: ('@/home/ansible/venv/20220328-xyz/attempt2/playbooks/app_templates/App1.yaml',) forks: 5 1 plays in create_app.yaml
PLAY [Create LTM/GTM Config] ***Loading collection f5networks.f5_modules from /home/ansible/venv/20220328-xyz/attempt2/playbooks/collections/ansible_collections/f5networks/f5_modules META: ran handlers
TASK [include_tasks] ***task path: /home/ansible/venv/20220328-xyz/attempt2/playbooks/create_app.yaml:13
included: /home/ansible/venv/20220328-xyz/attempt2/playbooks/ltm_tasks.yaml for localhost => (item={'datacenter_name': 'Zone1', 'vip_address': '10.1.10.101:80', 'pool_members': [{'pm': '10.1.20.101:8001', 'pr': 10}, {'pm': '10.1.20.102:8002', 'pr': 7}]})
included: /home/ansible/venv/20220328-xyz/attempt2/playbooks/ltm_tasks.yaml for localhost => (item={'datacenter_name': 'Zone2', 'vip_address': '10.1.110.101:80', 'pool_members': [{'pm': '10.1.120.101:8001', 'pr': 10}, {'pm': '10.1.120.102:8002', 'pr': 7}]})
TASK [Create LTM Pool] *****task path: /home/ansible/venv/20220328-xyz/attempt2/playbooks/ltm_tasks.yaml:1
Any update on this?
Hi, internal ID to track this item is: INFRAANO-982, thanks!
Hi @tashafan , I looked up the repo https://github.com/focrensh/f5-ansible_multi-zone to reproduce the issue. I noticed that task that creates GTM virtual servers in gtm_tasks.yaml is referencing GTM servers (different from the GTM virtual servers), but didn't see any tasks mean for creating those, so I think you need to create the GTM servers before running the tasks in gtm_tasks.yaml.
Hi,
Please reopen if you are still facing the issue.
COMPONENT NAME
bigip_pool
Environment
VENV with Collections
ANSIBLE VERSION
BIGIP VERSION
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
I am running a playbook to create multizone application. Purpose of this application is to create a combination of VIP/Pools and WIP. Here are the components related to the Playbook. https://github.com/focrensh/f5-ansible_multi-zone This playbook fails at this task. TASK [Create LTM Pool] //////////////////////////////////\\\\\\\\\\\\\\\\ Error Output "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1648593748.7796683-17358-219517451221540/AnsiballZ_bigip_pool.py\", line 107, in\n _ansiballz_main()\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1648593748.7796683-17358-219517451221540/AnsiballZ_bigip_pool.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1648593748.7796683-17358-219517451221540/AnsiballZ_bigip_pool.py\", line 48, in invoke_module\n run_name='main', alter_sys=True)\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_pool.py\", line 1261, in \n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_pool.py\", line 1254, in main\n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_pool.py\", line 827, in exec_module\n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 134, in send_teem\n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 70, in send\n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 45, in prepare_request\n File \"/tmp/ansible_bigip_pool_payload_RNka3z/ansible_bigip_pool_payload.zip/ansible_collections/f5networks/f5_modules/plugins/module_utils/teem.py\", line 92, in build_telemetry\nTypeError: split() takes no keyword arguments\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////////////////
STEPS TO REPRODUCE
EXPECTED RESULTS
Running playbook will produce 2 VIPs and a WIP along with its related components.
ACTUAL RESULTS