24-Feb-2019
23:32
- last edited on
21-Nov-2022
21:36
by
JimmyPackets
I want to use Ansible to make the BIG-IP pool member offline, I found below code in Ansible document.
I use the node IP address on "host" parameter (I tried input IP address directly), but it doesn't work when I use IP address, only use node name can success offline line the member, is it possible to use the node IP address to offline?
Also, if the node IP didn't used, BIG-IP will create new node and assign to pool, both IP and name will use IP address and the state will be offline. Is it possible to stop BIG-IP create new node?
=========================================
Ansible code
=========================================
- name: Force pool member offline
bigip_pool_member:
server: lb.mydomain.com
user: admin
password: secret
state: forced_offline
pool: my-pool
partition: Common
host: "{{ ansible_default_ipv4['address'] }}"
port: 80
delegate_to: localhost
=========================================
The error output (If use IP address)
=========================================
fatal: [127.0.0.1 -> localhost]: FAILED! => {"changed": false, "msg": "400 Unexpected Error: Bad Request for uri: https://mybigipaddress:443/mgmt/tm/ltm/pool/~Common~QA_Pool/members/\nText: u'{\"code\":400,\"message\":\"0107003a:3: Pool member node (/Common/1.2.3.4) and existing node (/Common/test02) cannot use the same IP Address (1.2.3.4).\",\"errorStack\":[],\"apiError\":3}'"}
=========================================
The success output (If use node name)
=========================================
changed: [127.0.0.1 -> localhost] => {"changed": true, "session": "user-disabled", "state": "forced_offline"}