F5Networks / f5-ansible

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

bigip_pool_member - fails to set IPv6 pool member with port set to 0/any & partition other than common #721

Closed neozoolook closed 6 years ago

neozoolook commented 6 years ago
ISSUE TYPE
COMPONENT NAME

bigip_pool_member.py

ANSIBLE VERSION
ansible 2.5.0
  config file = /root/ansible-bb_cgnat_configuration/ansible.cfg
  configured module search path = [u'/root/ansible-bb_cgnat_configuration/library/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]
PYTHON VERSION
Python 2.7.6
BIGIP VERSION
Sys::Version
Main Package
  Product     BIG-IP
  Version     12.1.2
  Build       1.49.271
  Edition     Engineering Hotfix HF1
  Date        Fri May 19 13:49:47 PDT 2017

Hotfix List
ID602136-5    ID624526-3   ID624228-1  ID633181-1  ID632472-1   ID580026-5
ID634215-1    ID644489-1   ID627246-1  ID628890-1  ID629698-1   ID624831-2
ID620215-5    ID634115-1   ID606518-3  ID609107-1  ID649571-1   ID574020-5
ID586738-4    ID646760     ID583943-1  ID627747-1  ID572885-1   ID633413-1
ID635541      ID631627-4   ID638799-1  ID632668-5  ID628009-1   ID596067-2
ID655500      ID624023-3   ID541550-3  ID652151-1  ID623927-2   ID630546-1
ID648544-5    ID606771-2   ID627433-1  ID631722    ID593078-1   ID635252-1
ID623930-3    ID580168-4   ID608408-2  ID643187-2  ID599858-7   ID424542-5
ID641512-4    ID614563-3   ID592871-3  ID642874-1  ID562928-2   ID557471-3
ID543208-1    ID635129     ID610180-2  ID601180-2  ID616059-1   ID626542-2
ID620659-3    ID649617-2   ID579926-1  ID628623-1  ID655240     ID564281-3
ID601828-1    ID589379-2   ID621447-1  ID618261-6  ID609691-1   ID621337-6
ID630622-1    ID576591-6   ID624193-2  ID613536-5  ID642983-1   ID604061-2
ID629845-2    ID628897-1   ID610429-5  ID607152-1  ID613326-1   ID366695-1
ID628685-2    ID627972-2   ID636044-1  ID628348-1  ID600827-8   ID653453
ID611487-3    ID626386-1   ID628337-1  ID599191-2  ID645805     ID608304-1
ID631025-1    ID541320-10  ID587966-1  ID594127-2  ID618254-4   ID621909-4
ID621210-2    ID621937-1   ID632731-2  ID639193-1  ID534520-1   ID619071-3
ID624198-1    ID624263-4   ID633512-1  ID617628-1  ID624570-1   ID619849-4
ID623119      ID628202-4   ID642058-1  ID622496    ID599285-2   ID584582-1
ID509858-5    ID619663-3   ID620829-2  ID624876-1  ID610295-1   ID616838-3
ID624744-1    ID651476     ID626106-3  ID584310-1  ID603082-3   ID632499-1
ID642015-2    ID604727-1   ID624361-1  ID625172-1  ID619473-2   ID600223-2
ID595819-1    ID614296-1   ID620366-4  ID608320-3  ID606257-3   ID583024-1
ID583754-7    ID611512-1   ID611669-4  ID620079-3  ID631131-3   ID639750-1
ID625824-1    ID627059-1   ID637559-1  ID631862-1  ID625474-1   ID658036-1
ID648879-2    ID592113-5   ID524277-2  ID612809-1  ID652484-2   ID621524-2
ID630661-2    ID601268-5   ID630571-1  ID627117-1  ID641574     ID620614-4
ID623885-4    ID642284     ID611161-3  ID620635-2  ID623518-1   ID627914-1
ID627403-2    ID562267-3   ID625098-3  ID631688-7  ID636254-2   ID619811-2
ID621976-4    ID641390-5   ID623562-3  ID585097-1  ID615970-1   ID629085-1
ID641612-2    ID628687-2   ID568543-4  ID625085    ID627360-1   ID610129-3
ID655594-1    ID619398-7   ID589400-1  ID540928-1  ID642039-2   ID620625-2
ID648990      ID610417-1   ID625783-1  ID622126-1  ID627257-2   ID633391-1
ID609788      ID639236-1   ID625703-2  ID626438-1  ID621974-4   ID625832-4
ID626851-2    ID628836-4   ID557358-5  ID608551-3  ID625671-4   ID584029-6
ID632005-1    ID632324-2   ID628869-4  ID611658-3  ID633723-3   ID584082-3
ID352957-4    ID569316-1   ID621239-2  ID631737-1  ID649933-1   ID610302-1
ID602830-1    ID635961-1   ID419741-3  ID596450-1  ID641256-1   ID632326-2
ID602376-1    ID533956-3   ID625106-2  ID627961-3  ID623093-1   ID628972-2
ID621273-1    ID627279-2   ID609084-2  ID641248    ID584471-1   ID615934-1
ID600205-9    ID581840-5   ID582769-1  ID630150-1  ID629069-2   ID623401-1
ID581746-1    ID637181-4   ID601378-2  ID567457-2  ID630610-5   ID627898-2
ID635754-1    ID638137     ID625198-1  ID517756-6  ID620400-1   ID635561-1
ID560114-6    ID627907-1   ID625542-1  ID632504-1  ID641482-2   ID642400-2
ID622244-2    ID628164-3   ID604496-4  ID603979-4  ID606710-10  ID591246-1
ID622913-2    ID618170-3   ID605010-1  ID624616-1  ID636918-2   ID615267-2
ID644490-1    ID621870-2   ID632423-4  ID617063-1  ID636397-1   ID634001-2
ID570217-2    ID594642-3   ID600232-9  ID624457-5  ID619528-4   ID557434-4
ID648056-2    ID626599-3   ID643404-2  ID625159-1  ID598134-1   ID636520-3
ID636702-3    ID621126-2   ID635233-3  ID630929-1  ID634576     ID590805-4
ID595272-1    ID622183-5   ID605420-5  ID617858-2  ID640352-2   ID634252
ID630475-5    ID626839     ID500452-8  ID625275-1  ID629871-2   ID613225-7
ID621957-2    ID643547-1   ID621935-6  ID619879-1  ID617901-1   ID618428
ID590211-2    ID599121-2   ID600982-5  ID639744-1  ID648865-2   ID641445-1
ID599720-2    ID629127-1   ID618517-1  ID600593-1  ID622856-1   ID626910-1
ID640903-1    ID629530-2   ID624966-2  ID627214-3  ID596340-8   ID583516-2
ID603723-2    ID642330-2   ID624733-1  ID637308-8  ID618404-1   ID609027-1
ID623922-5    ID638780-3   ID641013-5  ID640510-3  ID431840-3   ID584374-2
ID617310-2    ID622790-1   ID640521-1  ID633349    ID632386-1   ID642221-2
ID626360      ID616918-1   ID618430-2  ID625372-5  ID612419-1   ID598498-7
ID627916-1    ID597270-2   ID643396-2  ID611151-2  ID629627-1   ID622662-7
ID503842-4    ID620801-3   ID629412-3  ID638935-3  ID611968-3   ID609244-4
ID618771-1    ID618779-1   ID600052-1  ID597828-1  ID617002-1   ID612769-1
ID575027-1    ID631582     ID640824-1  ID632685    ID632344-2   ID603550-1
ID651106      ID564876-2   ID635116-1  ID392121-3  ID591666-3   ID644970-1
ID613765-3    ID635412     ID628832-4  ID629801-2  ID610255-1   ID418349-2
ID636535      ID423629-3   ID608245    ID615254-2  ID631472-1   ID660170-1
ID600198-2    ID608424-2   ID615107-1  ID614509-1  ID623023-1   ID630611-1
ID627798-3    ID609614-3   ID635933-3  ID636290    ID612694-5   ID621115-1
ID631841-7    ID640457-2   ID629499-9  ID573764-1  ID648715-2   ID636370
ID629145-1    ID629663-1   ID601255-4  ID603667-2  ID604237-3   ID633879-1
ID646511-1    ID619486-3   ID581406-1  ID630306-1  ID623336-4   ID623055-1
ID626721-5    ID597214-5   ID641360-2  ID636699-5  ID616022-2   ID621371-2
ID609119-7    ID598002-10
LIBRARY VERSIONS
bigsuds==1.0.6
f5-sdk==3.0.14
CONFIGURATION

Default/local ansible.cfg

OS / ENVIRONMENT

Ubuntu 16.04TS

SUMMARY

Created a pool, then leveraging bigip_pool_member to add two entries, first is IPv4 second is IPv6. Both members are set to leverage port '0' or Any, IPv4 gets added, however IPv6 fails due to odd error complaining of missing port value not specified.

STEPS TO REPRODUCE
---
- name: Create LTM Pool for Gateway
  bigip_pool:
    name: "{{ item.name }}"
    partition: "{{ item.partition }}"
    monitors: "/Common/gateway_icmp"
    state: "present"
    server: "{{ ansible_host }}"
    user: "{{ username }}"
    password: "{{ password }}"
    validate_certs: "no"
  delegate_to: localhost
  with_items: "{{ partition_pool_list }}"

- name: Add pool member for Gateway
  bigip_pool_member:
    pool: "{{ item.name }}"
    partition: "{{ item.partition }}"
    host: "{{ item.host }}"
    port: "{{ item.port }}"
    monitor_state: "enabled"
    state: "present"
    server: "{{ ansible_host }}"
    user: "{{ username }}"
    password: "{{ password }}"
    validate_certs: "no"
  delegate_to: localhost
  with_items: "{{ partition_pool_list }}"

VARS;
---
partition_vlans_list:
  - index: 0
    name: "INT-NONHTTP1"
    interface: "1.1"
    partition: "NONHTTP1"
  - index: 1
    name: "SGI-DIRECT1"
    interface: "1.3"
    partition: "NONHTTP1"
  - index: 2
    name: "INT-NONHTTP2"
    interface: "1.2"
    partition: "NONHTTP2"
  - index: 3
    name: "SGI-DIRECT2"
    interface: "1.4"
    partition: "NONHTTP2"
mtu: "9100"

partition_pool_list:
  - index: 0
    name: "SR1-IPV4"
    host: "102.102.102.253"
    port: 0
    partition: "NONHTTP1"
  - index: 1
    name: "SR1-IPV6"
    host: "2013::253"
    port: 0
    partition: "NONHTTP1"
EXPECTED RESULTS
ACTUAL RESULTS
root@image-factory:~/ansible-bb_cgnat_configuration# ansible-playbook site.yml --ask-vault-pass --tags pool_http -vvvv
ansible-playbook 2.5.0
  config file = /root/ansible-bb_cgnat_configuration/ansible.cfg
  configured module search path = [u'/root/ansible-bb_cgnat_configuration/library/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]
Using /root/ansible-bb_cgnat_configuration/ansible.cfg as config file
Vault password: 
setting up inventory plugins
Parsed /root/ansible-bb_cgnat_configuration/hosts.inv inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc

PLAYBOOK: site.yml ************************************************************************************
1 plays in site.yml

PLAY [single] *****************************************************************************************
META: ran handlers
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7ff942694410> for vault_id=default

TASK [Configuration NON-HTTP Partition(s)] ************************************************************
task path: /root/ansible-bb_cgnat_configuration/site.yml:22
statically imported: /root/ansible-bb_cgnat_configuration/roles/f5_partition_http/tasks/f5_create_vlan.yml
statically imported: /root/ansible-bb_cgnat_configuration/roles/f5_partition_http/tasks/f5_create_interface.yml
statically imported: /root/ansible-bb_cgnat_configuration/roles/f5_partition_http/tasks/f5_pool_gateway.yml

TASK [f5_partition_http : Create LTM Pool for Gateway] ************************************************
task path: /root/ansible-bb_cgnat_configuration/roles/f5_partition_http/tasks/f5_pool_gateway.yml:2
<localhost> connection transport is rest
Using module file /root/ansible-bb_cgnat_configuration/library/modules/bigip_pool.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
ok: [zrdm5afcgn01natZZZ -> localhost] => (item={u'index': 0, u'host': u'102.102.102.253', u'partition': u'NONHTTP1', u'name': u'SR1-IPV4', u'port': 0}) => {
    "changed": false, 
    "deprecations": [
        {
            "msg": "Param 'user' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'password' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'server' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'validate_certs' is deprecated. See the module docs for more information", 
            "version": 2.9
        }
    ], 
    "invocation": {
        "module_args": {
            "description": null, 
            "lb_method": null, 
            "metadata": null, 
            "monitor_type": null, 
            "monitors": [
                "/Common/gateway_icmp"
            ], 
            "name": "SR1-IPV4", 
            "partition": "NONHTTP1", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "priority_group_activation": null, 
            "provider": {
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "server": "172.17.32.24", 
                "server_port": 443, 
                "ssh_keyfile": null, 
                "timeout": 10, 
                "transport": "rest", 
                "user": "admin", 
                "validate_certs": false
            }, 
            "quorum": null, 
            "reselect_tries": null, 
            "server": "172.17.32.24", 
            "server_port": null, 
            "service_down_action": null, 
            "slow_ramp_time": null, 
            "state": "present", 
            "transport": null, 
            "user": "admin", 
            "validate_certs": false
        }
    }, 
    "item": {
        "host": "102.102.102.253", 
        "index": 0, 
        "name": "SR1-IPV4", 
        "partition": "NONHTTP1", 
        "port": 0
    }, 
    "partition": "Common"
}
<localhost> connection transport is rest
Using module file /root/ansible-bb_cgnat_configuration/library/modules/bigip_pool.py
<localhost> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
ok: [zrdm5afcgn01natZZZ -> localhost] => (item={u'index': 1, u'host': u'2013::253', u'partition': u'NONHTTP1', u'name': u'SR1-IPV6', u'port': 0}) => {
    "changed": false, 
    "deprecations": [
        {
            "msg": "Param 'user' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'password' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'server' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'validate_certs' is deprecated. See the module docs for more information", 
            "version": 2.9
        }
    ], 
    "invocation": {
        "module_args": {
            "description": null, 
            "lb_method": null, 
            "metadata": null, 
            "monitor_type": null, 
            "monitors": [
                "/Common/gateway_icmp"
            ], 
            "name": "SR1-IPV6", 
            "partition": "NONHTTP1", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "priority_group_activation": null, 
            "provider": {
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "server": "172.17.32.24", 
                "server_port": 443, 
                "ssh_keyfile": null, 
                "timeout": 10, 
                "transport": "rest", 
                "user": "admin", 
                "validate_certs": false
            }, 
            "quorum": null, 
            "reselect_tries": null, 
            "server": "172.17.32.24", 
            "server_port": null, 
            "service_down_action": null, 
            "slow_ramp_time": null, 
            "state": "present", 
            "transport": null, 
            "user": "admin", 
            "validate_certs": false
        }
    }, 
    "item": {
        "host": "2013::253", 
        "index": 1, 
        "name": "SR1-IPV6", 
        "partition": "NONHTTP1", 
        "port": 0
    }, 
    "partition": "Common"
}

TASK [f5_partition_http : Add pool member for Gateway] ************************************************
task path: /root/ansible-bb_cgnat_configuration/roles/f5_partition_http/tasks/f5_pool_gateway.yml:15
<localhost> connection transport is rest
Using module file /root/ansible-bb_cgnat_configuration/library/modules/bigip_pool_member.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
ok: [zrdm5afcgn01natZZZ -> localhost] => (item={u'index': 0, u'host': u'102.102.102.253', u'partition': u'NONHTTP1', u'name': u'SR1-IPV4', u'port': 0}) => {
    "changed": false, 
    "deprecations": [
        {
            "msg": "Param 'user' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'password' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'server' is deprecated. See the module docs for more information", 
            "version": 2.9
        }, 
        {
            "msg": "Param 'validate_certs' is deprecated. See the module docs for more information", 
            "version": 2.9
        }
    ], 
    "invocation": {
        "module_args": {
            "address": "102.102.102.253", 
            "connection_limit": null, 
            "description": null, 
            "fqdn": null, 
            "fqdn_auto_populate": null, 
            "host": "102.102.102.253", 
            "monitor_state": "enabled", 
            "name": null, 
            "partition": "NONHTTP1", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "pool": "SR1-IPV4", 
            "port": 0, 
            "preserve_node": null, 
            "priority_group": null, 
            "provider": {
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "server": "172.17.32.24", 
                "server_port": 443, 
                "ssh_keyfile": null, 
                "timeout": 10, 
                "transport": "rest", 
                "user": "admin", 
                "validate_certs": false
            }, 
            "rate_limit": null, 
            "ratio": null, 
            "reuse_nodes": true, 
            "server": "172.17.32.24", 
            "server_port": null, 
            "session_state": null, 
            "state": "present", 
            "transport": null, 
            "user": "admin", 
            "validate_certs": false
        }
    }, 
    "item": {
        "host": "102.102.102.253", 
        "index": 0, 
        "name": "SR1-IPV4", 
        "partition": "NONHTTP1", 
        "port": 0
    }, 
    "state": "disabled"
}
<localhost> connection transport is rest
Using module file /root/ansible-bb_cgnat_configuration/library/modules/bigip_pool_member.py
<localhost> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
The full traceback is:
  File "/tmp/ansible_ZAkiEF/ansible_module_bigip_pool_member.py", line 854, in main
    results = mm.exec_module()
  File "/tmp/ansible_ZAkiEF/ansible_module_bigip_pool_member.py", line 582, in exec_module
    raise F5ModuleError(str(e))
failed: [zrdm5afcgn01natZZZ -> localhost] (item={u'index': 1, u'host': u'2013::253', u'partition': u'NONHTTP1', u'name': u'SR1-IPV6', u'port': 0}) => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "address": "2013::253", 
            "connection_limit": null, 
            "description": null, 
            "fqdn": null, 
            "fqdn_auto_populate": null, 
            "host": "2013::253", 
            "monitor_state": "enabled", 
            "name": null, 
            "partition": "NONHTTP1", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "pool": "SR1-IPV6", 
            "port": 0, 
            "preserve_node": null, 
            "priority_group": null, 
            "provider": {
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "server": "172.17.32.24", 
                "server_port": 443, 
                "ssh_keyfile": null, 
                "timeout": 10, 
                "transport": "rest", 
                "user": "admin", 
                "validate_certs": false
            }, 
            "rate_limit": null, 
            "ratio": null, 
            "reuse_nodes": true, 
            "server": "172.17.32.24", 
            "server_port": null, 
            "session_state": null, 
            "state": "present", 
            "transport": null, 
            "user": "admin", 
            "validate_certs": false
        }
    }, 
    "item": {
        "host": "2013::253", 
        "index": 1, 
        "name": "SR1-IPV6", 
        "partition": "NONHTTP1", 
        "port": 0
    }, 
    "msg": "400 Unexpected Error: Bad Request for uri: https://172.17.32.24:443/mgmt/tm/ltm/pool/~NONHTTP1~SR1-IPV6/members/~NONHTTP1~2013::253:0\nText: u'{\"code\":400,\"message\":\"A port number or service name is missing for \\\\\"/NONHTTP1/2013::253:0\\\\\". Please specify a port number or service name using the syntax \\\\\"/NONHTTP1/2013::253:0.<port>\\\\\".\",\"errorStack\":[],\"apiError\":26214401}'"
}

PLAY RECAP ********************************************************************************************
zrdm5afcgn01natZZZ         : ok=1    changed=0    unreachable=0    failed=1  
caphrim007 commented 6 years ago

problem with parsing IPv6 addresses...because of course we embed the port in the name (in REST) instead of a separate field. smh