F5Networks / f5-ansible

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

bigip route_domain module question #678

Closed brettcarr1 closed 6 years ago

brettcarr1 commented 6 years ago
ISSUE TYPE
COMPONENT NAME

route_domain

ANSIBLE VERSION
ansible 2.5.0
  config file = None
  configured module search path = [u'/Users/brettcarr/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Jul 15 2017, 17:16:57) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
PYTHON VERSION
Python 2.7.10
BIGIP VERSION
Sys::Version
Main Package
  Product     BIG-IP
  Version     11.6.1
  Build       0.0.317
  Edition     Final
  Date        Wed May  4 17:48:47 PDT 2016
LIBRARY VERSIONS
bigsuds==1.0.6
f5-sdk==3.0.11
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
caphrim007 commented 6 years ago

@brettcarr1 you've reported no bug here. what's the problem?

brettcarr1 commented 6 years ago

Oh stange the large description I typed in didn't make it into the post for some reason, Ill reformulate it and post it again here shortly. Apologies for confusion :)

brettcarr1 commented 6 years ago

I have a playbook using the big_routedomain module (shown below) which is simply designed to enable BGP and BFD

---
- hosts: bigip
  gather_facts: no
  vars_prompt:
    - name: "bigip_pwd"
      prompt: "BIGIP Admin Password"
  tasks:
  - name: enable-bgp
    bigip_routedomain:
      routing_protocol:
        - BGP
        - BFD
      state: present
      id: 0
      password: "{{ bigip_pwd }}"
      server: bigip
      user: admin
    delegate_to: localhost

This is working fine, however when I use it I get warnings about deprecated items:

[DEPRECATION WARNING]: Param 'user' is deprecated. See the module docs for more information. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. [DEPRECATION WARNING]: Param 'password' is deprecated. See the module docs for more information. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. [DEPRECATION WARNING]: Param 'server' is deprecated. See the module docs for more information. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

So I have tried to rewrite the module using provider: shown below:

---
- hosts: bigip
  gather_facts: no
  vars_prompt:
    - name: "bigip_pwd"
      prompt: "BIGIP Admin Password"
  tasks:
  - name: enable-bgp
    bigip_routedomain:
      routing_protocol: BGP
      state: present
      id: 0
      provider:
        server: "bigip"
        password: "{{ bigip_pwd }}"
        user: "admin"
        validate_certs: "no"
    delegate_to: localhost

However when I run this I get errors show below:

TASK [enable-bgp] **** task path: /Users/brettcarr/ansible/f5enablebgp2.yaml:8 Using module file /Library/Python/2.7/site-packages/ansible/modules/network/f5/bigip_routedomain.py

ESTABLISH LOCAL CONNECTION FOR USER: brettcarr EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273 `" && echo ansible-tmp-1521916792.41-92959086491273="` echo /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273 `" ) && sleep 0' PUT /Users/brettcarr/.ansible/tmp/ansible-local-28889H3Y0_i/tmpirGzO1 TO /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273/bigip_routedomain.py EXEC /bin/sh -c 'chmod u+x /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273/ /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273/bigip_routedomain.py && sleep 0' EXEC /bin/sh -c '/usr/bin/python /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273/bigip_routedomain.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /Users/brettcarr/.ansible/tmp/ansible-tmp-1521916792.41-92959086491273/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_GL6tNG/ansible_module_bigip_routedomain.py", line 580, in main() File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_GL6tNG/ansible_module_bigip_routedomain.py", line 571, in main obj = BigIpRouteDomain(check_mode=module.check_mode, **module.params) File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_GL6tNG/ansible_module_bigip_routedomain.py", line 229, in __init__ token=True) File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 168, in __init__ self.post_configuration_setup() File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 114, in post_configuration_setup self._get_tmos_version() File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 122, in _get_tmos_version response = connect.get(base_uri) File "/Library/Python/2.7/site-packages/icontrol/session.py", line 270, in wrapper response = method(self, REST_uri, **kwargs) File "/Library/Python/2.7/site-packages/icontrol/session.py", line 509, in get prepared = self.session.prepare_request(req) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 437, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/Library/Python/2.7/site-packages/requests/models.py", line 309, in prepare self.prepare_auth(auth, url) File "/Library/Python/2.7/site-packages/requests/models.py", line 540, in prepare_auth r = auth(self) File "/Library/Python/2.7/site-packages/icontrol/authtoken.py", line 254, in __call__ self.get_new_token(netloc) File "/Library/Python/2.7/site-packages/icontrol/authtoken.py", line 150, in get_new_token auth=HTTPBasicAuth(self.username, self.password) File "/Library/Python/2.7/site-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, **kwargs) File "/Library/Python/2.7/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 508, in request resp = self.send(prep, **send_kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/Library/Python/2.7/site-packages/requests/adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)) fatal: [bigip -> localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_GL6tNG/ansible_module_bigip_routedomain.py\", line 580, in \n main()\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_GL6tNG/ansible_module_bigip_routedomain.py\", line 571, in main\n obj = BigIpRouteDomain(check_mode=module.check_mode, **module.params)\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_GL6tNG/ansible_module_bigip_routedomain.py\", line 229, in __init__\n token=True)\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 168, in __init__\n self.post_configuration_setup()\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 114, in post_configuration_setup\n self._get_tmos_version()\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 122, in _get_tmos_version\n response = connect.get(base_uri)\n File \"/Library/Python/2.7/site-packages/icontrol/session.py\", line 270, in wrapper\n response = method(self, REST_uri, **kwargs)\n File \"/Library/Python/2.7/site-packages/icontrol/session.py\", line 509, in get\n prepared = self.session.prepare_request(req)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 437, in prepare_request\n hooks=merge_hooks(request.hooks, self.hooks),\n File \"/Library/Python/2.7/site-packages/requests/models.py\", line 309, in prepare\n self.prepare_auth(auth, url)\n File \"/Library/Python/2.7/site-packages/requests/models.py\", line 540, in prepare_auth\n r = auth(self)\n File \"/Library/Python/2.7/site-packages/icontrol/authtoken.py\", line 254, in __call__\n self.get_new_token(netloc)\n File \"/Library/Python/2.7/site-packages/icontrol/authtoken.py\", line 150, in get_new_token\n auth=HTTPBasicAuth(self.username, self.password)\n File \"/Library/Python/2.7/site-packages/requests/api.py\", line 112, in post\n return request('post', url, data=data, json=json, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/api.py\", line 58, in request\n return session.request(method=method, url=url, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 508, in request\n resp = self.send(prep, **send_kwargs)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 618, in send\n r = adapter.send(request, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/adapters.py\", line 508, in send\n raise ConnectionError(e, request=request)\nrequests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1 }
brettcarr1 commented 6 years ago

Note despite the above my provider section is indented, pasting in again below to see if it looks right this time.

---
- hosts: bigip
  gather_facts: no
  vars_prompt:
    - name: "bigip_pwd"
      prompt: "BIGIP Admin Password"
  tasks:
  - name: enable-bgp
    bigip_routedomain:
      routing_protocol: BGP
      state: present
      id: 0
      provider:
        server: "bigip"
        password: "{{ bigip_pwd }}"
        user: "admin"
        validate_certs: "no"
    delegate_to: localhost
caphrim007 commented 6 years ago

@brettcarr1 your problem is likely that the server you specified, server: "bigip" is not something that resolves in either DNS or your /etc/hosts file.

What you likely want is for Ansible to use the hosts: line's bigip, which probably resolves to a correct IP or DNS name.

Change your server: line to server: "{{ ansible_host }}"

brettcarr1 commented 6 years ago

Slightly confused by your answer as "bigip" does resolve in DNS surely if it didn't the hosts entry at the top of the playbook wouldn't work either (my ansible inventory file contains this entry but not an ip address), anyway I made the change you suggested anyway and still get errors: New contents of playbook and the error below:


TASK [enable-bgp] **** task path: /Users/brettcarr/ansible/f5enablebgp2.yaml:8 Using module file /Library/Python/2.7/site-packages/ansible/modules/network/f5/bigip_routedomain.py

ESTABLISH LOCAL CONNECTION FOR USER: brettcarr EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731 `" && echo ansible-tmp-1521993521.77-32087602192731="` echo /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731 `" ) && sleep 0' PUT /Users/brettcarr/.ansible/tmp/ansible-local-53970xoowXx/tmpb1YfyR TO /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731/bigip_routedomain.py EXEC /bin/sh -c 'chmod u+x /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731/ /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731/bigip_routedomain.py && sleep 0' EXEC /bin/sh -c '/usr/bin/python /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731/bigip_routedomain.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /Users/brettcarr/.ansible/tmp/ansible-tmp-1521993521.77-32087602192731/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_gutb79/ansible_module_bigip_routedomain.py", line 580, in main() File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_gutb79/ansible_module_bigip_routedomain.py", line 571, in main obj = BigIpRouteDomain(check_mode=module.check_mode, **module.params) File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_gutb79/ansible_module_bigip_routedomain.py", line 229, in __init__ token=True) File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 168, in __init__ self.post_configuration_setup() File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 114, in post_configuration_setup self._get_tmos_version() File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 122, in _get_tmos_version response = connect.get(base_uri) File "/Library/Python/2.7/site-packages/icontrol/session.py", line 270, in wrapper response = method(self, REST_uri, **kwargs) File "/Library/Python/2.7/site-packages/icontrol/session.py", line 509, in get prepared = self.session.prepare_request(req) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 437, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/Library/Python/2.7/site-packages/requests/models.py", line 309, in prepare self.prepare_auth(auth, url) File "/Library/Python/2.7/site-packages/requests/models.py", line 540, in prepare_auth r = auth(self) File "/Library/Python/2.7/site-packages/icontrol/authtoken.py", line 254, in __call__ self.get_new_token(netloc) File "/Library/Python/2.7/site-packages/icontrol/authtoken.py", line 150, in get_new_token auth=HTTPBasicAuth(self.username, self.password) File "/Library/Python/2.7/site-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, **kwargs) File "/Library/Python/2.7/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 508, in request resp = self.send(prep, **send_kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/Library/Python/2.7/site-packages/requests/adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)) fatal: [bigip -> localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_gutb79/ansible_module_bigip_routedomain.py\", line 580, in \n main()\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_gutb79/ansible_module_bigip_routedomain.py\", line 571, in main\n obj = BigIpRouteDomain(check_mode=module.check_mode, **module.params)\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_gutb79/ansible_module_bigip_routedomain.py\", line 229, in __init__\n token=True)\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 168, in __init__\n self.post_configuration_setup()\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 114, in post_configuration_setup\n self._get_tmos_version()\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 122, in _get_tmos_version\n response = connect.get(base_uri)\n File \"/Library/Python/2.7/site-packages/icontrol/session.py\", line 270, in wrapper\n response = method(self, REST_uri, **kwargs)\n File \"/Library/Python/2.7/site-packages/icontrol/session.py\", line 509, in get\n prepared = self.session.prepare_request(req)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 437, in prepare_request\n hooks=merge_hooks(request.hooks, self.hooks),\n File \"/Library/Python/2.7/site-packages/requests/models.py\", line 309, in prepare\n self.prepare_auth(auth, url)\n File \"/Library/Python/2.7/site-packages/requests/models.py\", line 540, in prepare_auth\n r = auth(self)\n File \"/Library/Python/2.7/site-packages/icontrol/authtoken.py\", line 254, in __call__\n self.get_new_token(netloc)\n File \"/Library/Python/2.7/site-packages/icontrol/authtoken.py\", line 150, in get_new_token\n auth=HTTPBasicAuth(self.username, self.password)\n File \"/Library/Python/2.7/site-packages/requests/api.py\", line 112, in post\n return request('post', url, data=data, json=json, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/api.py\", line 58, in request\n return session.request(method=method, url=url, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 508, in request\n resp = self.send(prep, **send_kwargs)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 618, in send\n r = adapter.send(request, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/adapters.py\", line 508, in send\n raise ConnectionError(e, request=request)\nrequests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1 } to retry, use: --limit @/Users/brettcarr/ansible/f5enablebgp2.retry PLAY RECAP *********************************************************************************************************************************************************** bigip : ok=0 changed=0 unreachable=0 failed=1
caphrim007 commented 6 years ago

This line if your output suggests that it was not able to get either the hostname or IP address from the host in your inventory

.ConnectionError: HTTPSConnectionPool(host='none',

So, what does your inventory look like

brettcarr1 commented 6 years ago

Tim, relevant part of the inventory file below:

[lb] bigip dummy

On the command line I can resolve bigip see below

[brettcarr@liberator ~/ansible]$ host bigip bigip.blacksun.localnet has address 192.168.1.252 [brettcarr@liberator ~/ansible]$ ping bigip PING bigip.blacksun.localnet (192.168.1.252): 56 data bytes 64 bytes from 192.168.1.252: icmp_seq=0 ttl=64 time=2.519 ms 64 bytes from 192.168.1.252: icmp_seq=1 ttl=64 time=2.181 ms

and the original version of the playbook (IE before adding the provider section) worked fine (IE in that case DNS resolved bigip to an ip address and the playbook ran ok but with deprecation warnings pointing me towards adding provider section for future compatibility)

Thanks

Brett

On 25 Mar 2018, at 17:45, Tim Rupp notifications@github.com wrote:

This line if your output suggests that it was not able to get either the hostname or IP address from the host in your inventory

.ConnectionError: HTTPSConnectionPool(host='none',

So, what does your inventory look like

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/F5Networks/f5-ansible/issues/678#issuecomment-375984612, or mute the thread https://github.com/notifications/unsubscribe-auth/AKiHuqSLr1FvfbBeiASj4sQwu_nwa_rkks5th8migaJpZM4S5wd5.

caphrim007 commented 6 years ago

@brettcarr1 try changing {{ ansible_host }} to {{ inventory_hostname }}

brettcarr1 commented 6 years ago

Still no luck I'm afraid:

Playbook changed as per below:


Error received:

TASK [enable-bgp] **** task path: /Users/brettcarr/ansible/f5enablebgp2.yaml:8 Using module file /Library/Python/2.7/site-packages/ansible/modules/network/f5/bigip_routedomain.py

ESTABLISH LOCAL CONNECTION FOR USER: brettcarr EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878 `" && echo ansible-tmp-1522000548.11-266842849010878="` echo /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878 `" ) && sleep 0' PUT /Users/brettcarr/.ansible/tmp/ansible-local-56366qw9fK7/tmptR8wNl TO /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878/bigip_routedomain.py EXEC /bin/sh -c 'chmod u+x /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878/ /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878/bigip_routedomain.py && sleep 0' EXEC /bin/sh -c '/usr/bin/python /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878/bigip_routedomain.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /Users/brettcarr/.ansible/tmp/ansible-tmp-1522000548.11-266842849010878/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_Wj953l/ansible_module_bigip_routedomain.py", line 580, in main() File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_Wj953l/ansible_module_bigip_routedomain.py", line 571, in main obj = BigIpRouteDomain(check_mode=module.check_mode, **module.params) File "/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_Wj953l/ansible_module_bigip_routedomain.py", line 229, in __init__ token=True) File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 168, in __init__ self.post_configuration_setup() File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 114, in post_configuration_setup self._get_tmos_version() File "/Library/Python/2.7/site-packages/f5/bigip/__init__.py", line 122, in _get_tmos_version response = connect.get(base_uri) File "/Library/Python/2.7/site-packages/icontrol/session.py", line 270, in wrapper response = method(self, REST_uri, **kwargs) File "/Library/Python/2.7/site-packages/icontrol/session.py", line 509, in get prepared = self.session.prepare_request(req) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 437, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/Library/Python/2.7/site-packages/requests/models.py", line 309, in prepare self.prepare_auth(auth, url) File "/Library/Python/2.7/site-packages/requests/models.py", line 540, in prepare_auth r = auth(self) File "/Library/Python/2.7/site-packages/icontrol/authtoken.py", line 254, in __call__ self.get_new_token(netloc) File "/Library/Python/2.7/site-packages/icontrol/authtoken.py", line 150, in get_new_token auth=HTTPBasicAuth(self.username, self.password) File "/Library/Python/2.7/site-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, **kwargs) File "/Library/Python/2.7/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 508, in request resp = self.send(prep, **send_kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/Library/Python/2.7/site-packages/requests/adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)) fatal: [bigip -> localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_Wj953l/ansible_module_bigip_routedomain.py\", line 580, in \n main()\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_Wj953l/ansible_module_bigip_routedomain.py\", line 571, in main\n obj = BigIpRouteDomain(check_mode=module.check_mode, **module.params)\n File \"/var/folders/0z/kzwgz8x925n_lcwfv9m1wgtc0000gn/T/ansible_Wj953l/ansible_module_bigip_routedomain.py\", line 229, in __init__\n token=True)\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 168, in __init__\n self.post_configuration_setup()\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 114, in post_configuration_setup\n self._get_tmos_version()\n File \"/Library/Python/2.7/site-packages/f5/bigip/__init__.py\", line 122, in _get_tmos_version\n response = connect.get(base_uri)\n File \"/Library/Python/2.7/site-packages/icontrol/session.py\", line 270, in wrapper\n response = method(self, REST_uri, **kwargs)\n File \"/Library/Python/2.7/site-packages/icontrol/session.py\", line 509, in get\n prepared = self.session.prepare_request(req)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 437, in prepare_request\n hooks=merge_hooks(request.hooks, self.hooks),\n File \"/Library/Python/2.7/site-packages/requests/models.py\", line 309, in prepare\n self.prepare_auth(auth, url)\n File \"/Library/Python/2.7/site-packages/requests/models.py\", line 540, in prepare_auth\n r = auth(self)\n File \"/Library/Python/2.7/site-packages/icontrol/authtoken.py\", line 254, in __call__\n self.get_new_token(netloc)\n File \"/Library/Python/2.7/site-packages/icontrol/authtoken.py\", line 150, in get_new_token\n auth=HTTPBasicAuth(self.username, self.password)\n File \"/Library/Python/2.7/site-packages/requests/api.py\", line 112, in post\n return request('post', url, data=data, json=json, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/api.py\", line 58, in request\n return session.request(method=method, url=url, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 508, in request\n resp = self.send(prep, **send_kwargs)\n File \"/Library/Python/2.7/site-packages/requests/sessions.py\", line 618, in send\n r = adapter.send(request, **kwargs)\n File \"/Library/Python/2.7/site-packages/requests/adapters.py\", line 508, in send\n raise ConnectionError(e, request=request)\nrequests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: /mgmt/shared/authn/login (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1 }
caphrim007 commented 6 years ago

remove the provider, just make them top-level things. there may have been an issue with it in the 2.5 that was released. we made a number of changes to it after the 2.5 code freeze a month or two ago

brettcarr1 commented 6 years ago

Ok so removing the provider does make it work but of course the deprecated warnings re-appear. The main reason I was using provider was that I was hoping that it would enable me to use a non "admin" user (like the command module does) without upgrading my bigip to 12.0, I presume then this is my only option currently:

IE either use "admin" account or upgrade to 12.0

Another related question...

Is there a way for me to specify no routing protocols in the arguments so I can have a playbook that removes all the current protocols.

My aim is to have a playbook that enables BGP and BFD and another that removes BGP and BFD (leaving nothing behind)

Thanks for all your help really appreciate it.

Brett

caphrim007 commented 6 years ago

since all of the modules use the same REST APIs, no, if non-admin doesnt work on bigip_command, it would also not work on every other module.

Using the bigip_command module I think you could use the following tmsh command to remove all the protocols

tmsh modify net route-domain NUMBER routing-protocol none

In the route_domain module, I think you can just specify an empty list of protocols, such as

routing_protocol: ""

brettcarr1 commented 6 years ago

Thanks Tim we will then continue to use the admin credentials until we upgrade to 12.0

If I enter routing_protocol: "" in the route_domain module I get an error:

fatal: [bigip -> localhost]: FAILED! => {"changed": false, "msg": "routing_protocol must be one of: ['BFD', 'BGP', 'IS-IS', 'OSPFv2', 'OSPFv3', 'PIM', 'RIP', 'RIPng']"}

caphrim007 commented 6 years ago

lemme look. there was a large refactor of this module recently, so it may not have been fixed until after the 2.5 release

caphrim007 commented 6 years ago

it is indeed a deficiency in 2.5. it's fixed in the devel code (which will become 2.6)

brettcarr1 commented 6 years ago

Thanks so in 2.6 you will be able to enter routing_protocol: "" is there an ETA for 2.6?

caphrim007 commented 6 years ago

yes. I've not heard from Ansible what the ETA is. They just released 2.5, so I would expect several months from now