Forum Discussion
ansible - bigip_pool_member: cannot add pool member from "Common" to pool "Test"
Hi
I'm running into an issue when I create pool member in /Common and create a pool in /Test, I'm unable to add the pool members to the pool using ansible bigip_pool_member.
playbook
#
# Filename : pooltest.yaml
# Date : 20 Jul 2020
# Author : Balaji Venkataraman (xbalaji)
# Description : playbook to configure bigip pool with members in different partition
- name: create bigip_pool and add members to it
hosts: all
connection: local
gather_facts: False
vars:
remove_resources: false
lx_pool_name: "xbltmpool"
lx_provider:
server: "{{inventory_hostname}}"
user: "{{f5_username}}"
password: "{{f5_password}}"
validate_certs: False
timeout: 30
pool_members:
- "{{lx_pool_name}}-member-01.company.com"
- "{{lx_pool_name}}-member-02.company.com"
tasks:
- name: set create or delete flag
delegate_to: localhost
set_fact:
lx_state: "{% if remove_resources|lower == 'true' %}absent{% else %}present{% endif %}"
lx_action: "{% if remove_resources|lower == 'true' %}delete{% else %}create{% endif %}"
- name: "{{lx_action}} pool members"
delegate_to: localhost
bigip_node:
name: "{{item}}"
fqdn: "{{item}}"
state: "{{lx_state}}"
provider: "{{lx_provider}}"
partition: "/Common"
description: "ansible created LTM node - xbalaji"
loop: "{{pool_members|flatten(1)}}"
- name: "{{lx_action}} the pool"
delegate_to: localhost
bigip_pool:
state: "{{lx_state}}"
name: "{{lx_pool_name}}"
partition: "/Test"
lb_method: "round-robin"
monitors:
- "/Common/http"
provider: "{{lx_provider}}"
- name: "{{lx_action}} pool members to {{lx_pool_name}} "
delegate_to: localhost
bigip_pool_member:
state: "{{lx_state}}"
pool: "{{lx_pool_name}}"
partition: "/Test"
name: "{{item}}"
fqdn: "{{item}}"
port: "80"
fqdn_auto_populate: "no"
preserve_node: "yes"
reuse_nodes: "yes"
provider: "{{lx_provider}}"
loop: "{{pool_members|flatten(1)}}"
output:
PLAY [create bigip_pool and add members to it] **********************************************************************************************************************
TASK [set create or delete flag] ************************************************************************************************************************************
ok: [f5adcfxioc01-apidev.net.pge.com]
TASK [create pool members] ******************************************************************************************************************************************
changed: [f5adcfxioc01-apidev.net.pge.com] => (item=xbltmpool-member-01.company.com)
changed: [f5adcfxioc01-apidev.net.pge.com] => (item=xbltmpool-member-02.company.com)
TASK [create the pool] **********************************************************************************************************************************************
changed: [f5adcfxioc01-apidev.net.pge.com]
TASK [create pool members to xbltmpool] *****************************************************************************************************************************
failed: [f5adcfxioc01-apidev.net.pge.com] (item=xbltmpool-member-01.company.com) => {"ansible_loop_var": "item", "changed": false, "item": "xbltmpool-member-01.company.com", "msg": "01070734:3: Configuration error: FQDN Node (/Test/xbltmpool-member-01.company.com:xbltmpool-member-01.company.com) already exists as Node (/Common/xbltmpool-member-01.company.com)"}
failed: [f5adcfxioc01-apidev.net.pge.com] (item=xbltmpool-member-02.company.com) => {"ansible_loop_var": "item", "changed": false, "item": "xbltmpool-member-02.company.com", "msg": "01070734:3: Configuration error: FQDN Node (/Test/xbltmpool-member-02.company.com:xbltmpool-member-02.company.com) already exists as Node (/Common/xbltmpool-member-02.company.com)"}
PLAY RECAP **********************************************************************************************************************************************************
f5adcfxioc01-apidev.net.pge.com : ok=3 changed=2 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
seeing the following error, can someone let me know if there is anything that needs to be changed or is this a known problem.
Thanks and Regards,
Balaji
thanks for your reply on slack channel, here is the working playbook for anyone's future reference.
# # Filename : pooltest.yaml # Author : Balaji Venkataraman (xbalaji) # Description : playbook to configure bigip pool with members in different partition - name: create bigip_pool and add members to it hosts: all connection: local gather_facts: False vars: remove_resources: false lx_pool_name: "xbltmpool" lx_provider: server: "{{inventory_hostname}}" user: "{{f5_username}}" password: "{{f5_password}}" validate_certs: False timeout: 30 pool_members: - "{{lx_pool_name}}-member-01.company.com" - "{{lx_pool_name}}-member-02.company.com" tasks: - name: set create or delete flag delegate_to: localhost set_fact: lx_state: "{% if remove_resources|lower == 'true' %}absent{% else %}present{% endif %}" lx_action: "{% if remove_resources|lower == 'true' %}delete{% else %}create{% endif %}" - name: "{{lx_action}} pool members" delegate_to: localhost bigip_node: name: "{{item}}" fqdn: "{{item}}" state: "{{lx_state}}" provider: "{{lx_provider}}" partition: "/Common" description: "ansible created LTM node - xbalaji" loop: "{{pool_members|flatten(1)}}" - name: "{{lx_action}} the pool" delegate_to: localhost bigip_pool: state: "{{lx_state}}" name: "{{lx_pool_name}}" partition: "/Test" lb_method: "round-robin" monitors: - "/Common/http" provider: "{{lx_provider}}" - name: "{{lx_action}} pool members to {{lx_pool_name}} " delegate_to: localhost bigip_pool_member: state: "{{lx_state}}" pool: "/Test/{{lx_pool_name}}" name: "/Common/{{item}}" fqdn: "{{item}}" port: "80" fqdn_auto_populate: "no" preserve_node: "yes" reuse_nodes: "yes" provider: "{{lx_provider}}" loop: "{{pool_members|flatten(1)}}"
- xbalajiNimbostratus
thanks for your reply on slack channel, here is the working playbook for anyone's future reference.
# # Filename : pooltest.yaml # Author : Balaji Venkataraman (xbalaji) # Description : playbook to configure bigip pool with members in different partition - name: create bigip_pool and add members to it hosts: all connection: local gather_facts: False vars: remove_resources: false lx_pool_name: "xbltmpool" lx_provider: server: "{{inventory_hostname}}" user: "{{f5_username}}" password: "{{f5_password}}" validate_certs: False timeout: 30 pool_members: - "{{lx_pool_name}}-member-01.company.com" - "{{lx_pool_name}}-member-02.company.com" tasks: - name: set create or delete flag delegate_to: localhost set_fact: lx_state: "{% if remove_resources|lower == 'true' %}absent{% else %}present{% endif %}" lx_action: "{% if remove_resources|lower == 'true' %}delete{% else %}create{% endif %}" - name: "{{lx_action}} pool members" delegate_to: localhost bigip_node: name: "{{item}}" fqdn: "{{item}}" state: "{{lx_state}}" provider: "{{lx_provider}}" partition: "/Common" description: "ansible created LTM node - xbalaji" loop: "{{pool_members|flatten(1)}}" - name: "{{lx_action}} the pool" delegate_to: localhost bigip_pool: state: "{{lx_state}}" name: "{{lx_pool_name}}" partition: "/Test" lb_method: "round-robin" monitors: - "/Common/http" provider: "{{lx_provider}}" - name: "{{lx_action}} pool members to {{lx_pool_name}} " delegate_to: localhost bigip_pool_member: state: "{{lx_state}}" pool: "/Test/{{lx_pool_name}}" name: "/Common/{{item}}" fqdn: "{{item}}" port: "80" fqdn_auto_populate: "no" preserve_node: "yes" reuse_nodes: "yes" provider: "{{lx_provider}}" loop: "{{pool_members|flatten(1)}}"
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com