Closed brettcarr1 closed 6 years ago
@brettcarr1 you've reported no bug here. what's the problem?
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 :)
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
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
@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 }}"
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
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
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.
@brettcarr1 try changing {{ ansible_host }}
to {{ inventory_hostname }}
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
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
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
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: ""
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']"}
lemme look. there was a large refactor of this module recently, so it may not have been fixed until after the 2.5 release
it is indeed a deficiency in 2.5. it's fixed in the devel code (which will become 2.6)
Thanks so in 2.6 you will be able to enter routing_protocol: "" is there an ETA for 2.6?
yes. I've not heard from Ansible what the ETA is. They just released 2.5, so I would expect several months from now
ISSUE TYPE
COMPONENT NAME
route_domain
ANSIBLE VERSION
PYTHON VERSION
BIGIP VERSION
LIBRARY VERSIONS
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS