For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

xbalaji's avatar
xbalaji
Icon for Nimbostratus rankNimbostratus
Feb 17, 2021
Solved

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 # # Fil...
  • xbalaji's avatar
    Feb 17, 2021

      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)}}"