F5Networks / f5-ansible

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

bigip_device_connectivity | Unexpected Identifier #2007

Closed bwearp closed 3 years ago

bwearp commented 3 years ago
COMPONENT NAME

bigip_device_connectivity

Environment

ANSIBLE VERSION
ansible 2.10.7
  config file = /Users/ben/Dropbox/Ansible/F5 Ansible Automation/xls-to-facts/ansible.cfg
  configured module search path = ['/Users/ben/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ansible
  executable location = /Library/Frameworks/Python.framework/Versions/3.8/bin/ansible
  python version = 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18) [Clang 6.0 (clang-600.0.57)]
BIGIP VERSION
[root@bigip1:LICENSE EXPIRED:Standalone] config # tmsh show sys version

Sys::Version
Main Package
  Product     BIG-IP
  Version     14.1.2.1
  Build       0.0.4
  Edition     Point Release 1
  Date        Tue Sep 17 15:44:32 PDT 2019
CONFIGURATION

[ben]% cat /etc/ansible/ansible.cfg
[defaults] interpreter_python = /usr/local/bin/python3.9

OS / ENVIRONMENT

Big Sur 11.2.3

SUMMARY

Error: "msg": "b'{\"code\":400,\"message\":\"Unexpected identifier \\\"{\'address\': \'management-ip\'}\\\" \\\"{\\\" is required\",\"errorStack\":[],\"apiError\":26214401}'"

STEPS TO REPRODUCE
- name: Configure device connectivity for standard HA pair on {{ primary_server }}
    bigip_device_connectivity:
      provider:
        server: "{{ primary_server }}"
        user: "{{ admin_user }}"
        password: "{{ admin_password }}"
        validate_certs: no
      config_sync_ip: "{{ item.primary_address }}"
      mirror_primary_address: "{{ item.primary_address }}"
      unicast_failover:
        - address: management-ip
        - address: "{{ item.primary_address }}"    
    with_items: "{{ spreadsheet_network }}"
    when: item.vlan_name == 'HA'
    tags:
      - skip
EXPECTED RESULTS

HA connectivity to be configured

ACTUAL RESULTS
ASK [Configure device connectivity for standard HA pair on 192.168.1.233] **************************************************************************************************************************************************************************************
task path: /Users/ben/Dropbox/Ansible/F5 Ansible Automation/xls-to-facts/onboarding.yml:248
redirecting (type: action) ansible.builtin.bigip to f5networks.f5_modules.bigip
redirecting (type: action) ansible.builtin.bigip to f5networks.f5_modules.bigip
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ben
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp/.ansible-${USER}/tmp `"&& mkdir "` echo /tmp/.ansible-${USER}/tmp/ansible-tmp-1617703675.733543-24157-126271924792084 `" && echo ansible-tmp-1617703675.733543-24157-126271924792084="` echo /tmp/.ansible-${USER}/tmp/ansible-tmp-1617703675.733543-24157-126271924792084 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.bigip_device_connectivity to f5networks.f5_modules.bigip_device_connectivity
redirecting module_util ansible.module_utils.network.common.config to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config
redirecting module_util ansible.module_utils.network.common.config to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config
redirecting module_util ansible.module_utils.network.common.config to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config
redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils
redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils
redirecting module_util ansible.module_utils.compat.ipaddress to ansible_collections.ansible.netcommon.plugins.module_utils.compat.ipaddress
redirecting module_util ansible.module_utils.compat.ipaddress to ansible_collections.ansible.netcommon.plugins.module_utils.compat.ipaddress
redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils
redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils
Using module file /Users/ben/.ansible/collections/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_connectivity.py
<127.0.0.1> PUT /Users/ben/.ansible/tmp/ansible-local-24133lgh31qe1/tmpn91_e2km TO /private/tmp/.ansible-ben/tmp/ansible-tmp-1617703675.733543-24157-126271924792084/AnsiballZ_bigip_device_connectivity.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /tmp/.ansible-ben/tmp/ansible-tmp-1617703675.733543-24157-126271924792084/ /tmp/.ansible-ben/tmp/ansible-tmp-1617703675.733543-24157-126271924792084/AnsiballZ_bigip_device_connectivity.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /tmp/.ansible-ben/tmp/ansible-tmp-1617703675.733543-24157-126271924792084/AnsiballZ_bigip_device_connectivity.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /tmp/.ansible-ben/tmp/ansible-tmp-1617703675.733543-24157-126271924792084/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/var/folders/lq/hp2d_r012gxbprtfs0_xglqm0000gn/T/ansible_bigip_device_connectivity_payload_l3j8m1ru/ansible_bigip_device_connectivity_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_connectivity.py", line 688, in main
  File "/var/folders/lq/hp2d_r012gxbprtfs0_xglqm0000gn/T/ansible_bigip_device_connectivity_payload_l3j8m1ru/ansible_bigip_device_connectivity_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_connectivity.py", line 517, in exec_module
  File "/var/folders/lq/hp2d_r012gxbprtfs0_xglqm0000gn/T/ansible_bigip_device_connectivity_payload_l3j8m1ru/ansible_bigip_device_connectivity_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_connectivity.py", line 531, in update
  File "/var/folders/lq/hp2d_r012gxbprtfs0_xglqm0000gn/T/ansible_bigip_device_connectivity_payload_l3j8m1ru/ansible_bigip_device_connectivity_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_connectivity.py", line 568, in update_on_device
[WARNING]: The value "unicast_failover: {'address': 'management-ip'}" (type dict) was converted to "unicast_failover: "{'address': 'management-ip'}"" (type string). If this does not look like what you expect, quote the entire value to ensure it does not
change.
[WARNING]: The value "unicast_failover: {'address': '172.16.1.1'}" (type dict) was converted to "unicast_failover: "{'address': '172.16.1.1'}"" (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.
failed: [localhost] (item={'vlan_name': 'HA', 'vlan_id': 4094, 'tagged_interface': None, 'untagged_interface': 1.3, 'name_primary_address': 'HA', 'primary_address': '172.16.1.1', 'name_secondary_address': 'HA', 'secondary_address': '172.16.1.2', 'name_floating': None, 'floating': None, 'netmask': 30, 'route_domain_name': 0, 'route_domain': 0, 'partition': 'Common', 'description': None, 'state': 'present'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "cluster_mirroring": null,
            "config_sync_ip": "172.16.1.1",
            "failover_multicast": null,
            "mirror_primary_address": "172.16.1.1",
            "mirror_secondary_address": null,
            "multicast_address": null,
            "multicast_interface": null,
            "multicast_port": null,
            "provider": {
                "auth_provider": null,
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "server": "192.168.1.233",
                "server_port": null,
                "timeout": null,
                "transport": "rest",
                "user": "admin",
                "validate_certs": false
            },
            "unicast_failover": [
                "{'address': 'management-ip'}",
                "{'address': '172.16.1.1'}"
            ]
        }
    },
    "item": {
        "description": null,
        "floating": null,
        "name_floating": null,
        "name_primary_address": "HA",
        "name_secondary_address": "HA",
        "netmask": 30,
        "partition": "Common",
        "primary_address": "172.16.1.1",
        "route_domain": 0,
        "route_domain_name": 0,
        "secondary_address": "172.16.1.2",
        "state": "present",
        "tagged_interface": null,
        "untagged_interface": 1.3,
        "vlan_id": 4094,
        "vlan_name": "HA"
    },
    "msg": "b'{\"code\":400,\"message\":\"Unexpected identifier \\\\\"{\\'address\\': \\'management-ip\\'}\\\\\" \\\\\"{\\\\\" is required\",\"errorStack\":[],\"apiError\":26214401}'"
}
nmenant commented 3 years ago

I can't reproduce the issue you are having:

---

- hosts: default
  gather_facts: false
  vars: 
    provider:
      server: 192.168.143.154
      user: admin
      password: XXXxXXXXXXX
      validate_certs: no
      server_port: 443

  tasks:

    - name: Configure device connectivity for standard HA pair
      bigip_device_connectivity:
        config_sync_ip: 172.16.2.11
        mirror_primary_address: 172.16.2.11
        unicast_failover:
          - address: management-ip
          - address: 172.16.2.11
        provider: "{{ provider }}"
      delegate_to: localhost

I get the expected output:

(Ansible) BZH $ ansible-playbook -i hosts site.yml

PLAY [default] *********************************************************************************************************************************************************************************

TASK [Configure device connectivity for standard HA pair] **************************************************************************************************************************************
changed: [192.168.143.154]

PLAY RECAP *************************************************************************************************************************************************************************************
192.168.143.154            : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

(Ansible) BZH $

image

Could you try a more basic test like mine and see if it works as expected ?

trinaths commented 3 years ago

@bwearp Can you share your findings with suggestions from @nmenant .

bwearp commented 3 years ago

Hi,

Sorry. It was a typo on my behalf - moving from "server" to "provider" - I made a mistake.

Apologies. Thank you for your swift and effective response.

Kind regards,

Ben


From: Trinath Somanchi @.> Sent: 21 April 2021 21:46 To: F5Networks/f5-ansible @.> Cc: Ben Wyatt Ben.Wyatt@F5.com; Mention @.***> Subject: Re: [F5Networks/f5-ansible] bigip_device_connectivity | Unexpected Identifier (#2007)

EXTERNAL MAIL: @.***

@bwearphttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbwearp&data=04%7C01%7CBen.Wyatt%40F5.com%7C53044506a640468d3e0108d904ed6947%7Cdd3dfd2f6a3b40d19be0bf8327d81c50%7C0%7C0%7C637546239990573156%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=13d%2FRQDbtUNdkMlTenZ0xGuXIyPVdPXhUKP2OxisdMg%3D&reserved=0 Can you share your findings with suggestions from @nmenanthttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnmenant&data=04%7C01%7CBen.Wyatt%40F5.com%7C53044506a640468d3e0108d904ed6947%7Cdd3dfd2f6a3b40d19be0bf8327d81c50%7C0%7C0%7C637546239990573156%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2l0drt5%2F5H2Fmpqt%2BH42VrMqp2YsUuaBXeQsEQcQ5Yg%3D&reserved=0 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FF5Networks%2Ff5-ansible%2Fissues%2F2007%23issuecomment-824242931&data=04%7C01%7CBen.Wyatt%40F5.com%7C53044506a640468d3e0108d904ed6947%7Cdd3dfd2f6a3b40d19be0bf8327d81c50%7C0%7C0%7C637546239990583151%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2B4sQFpJHypRINfPQaBYCtdBKM86YeFqbdNHI86rayU%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIRHBUBB4SNLFBOMHJPDAATTJ4FPTANCNFSM42ONOVNQ&data=04%7C01%7CBen.Wyatt%40F5.com%7C53044506a640468d3e0108d904ed6947%7Cdd3dfd2f6a3b40d19be0bf8327d81c50%7C0%7C0%7C637546239990583151%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SVZJ%2B80ppEjEWN4s0hDzXTTOiHjjYHbIlFfwHikLNEs%3D&reserved=0.

trinaths commented 3 years ago

thank you. Closing this issue.