Exercise 2.0 - Disabling a pool member

Objective

For this last exercise instead of prescriptive step-by-step walkthrough a framework of objectives with hints for each step will be provided.

Demonstrate the removal of a node from the pool. Build a Playbook that:

  • Retrieve Facts from BIG-IP for the pools present on the BIG-IP (in our example only one pool is present)

  • Display pools available - Store the pool name as a fact - Display all the pool members that belong to the pool => IP and port information to the terminal window

  • Prompt the user to disable a particular member or disable all members of the pool

  • Force the appropriate pool members offline

Guide

Step 1:

Examine the disabled-pool-member.yml in the VSCode editor. Expand in the Explorer (f5-bd-ansible-labs –> 101-F5-Basics –> 2.0-disable-pool-member):

Examine the Code

  • The bigip_device_info: is the module for displaying information from the BIG-IP. Everything except register is a module parameter defined on the module documentation page.

  • The debug: module is used to display output from variables or other items like queries.

  • The set_fact: module is used to create variables used within the playbook.

  • The bigip_pool_member: is the module for adding/modifying/deleting pool members on the BIG-IP.

  • The provider: parameter is a group of connection details for the BIG-IP.

    • The server: "{{ ansible_host }}" parameter tells the module to connect to the F5 BIG-IP IP address, which is stored as a variable ansible_host in inventory

    • The user: "{{ ansible_user }}" parameter tells the module the username to login to the F5 BIG-IP device with

    • The password: "{{ ansible_password }}" parameter tells the module the password to login to the F5 BIG-IP device with

    • The server_port: "{{ server_port }} parameter tells the module the port to connect to the F5 BIG-IP device with

    • The validate_certs: false parameter tells the module to not validate SSL certificates. This is just used for demonstration purposes since this is a lab.

Step 2:

Change directories to the exercise 2.0 folder to examine and execute the code in the Terminal

cd ~/f5-bd-ansible-labs/101-F5-Basics/2.0-disable-pool-member/

Step 3:

Run the playbook - Go back to the Terminal on VS Code server on the control host and execute the following:

ansible-navigator run disable-pool-member.yml --mode stdout

Playbook Output

[rhel-user@ede... 2.0-disable-pool-member]$ ansible-navigator run disable-pool-member.yml --mode stdout

PLAY [Disabling a pool member] *************************************************

TASK [Setup provider] **********************************************************
ok: [f5]

TASK [Query BIG-IP facts] ******************************************************
ok: [f5]

TASK [Display Pools available] *************************************************
ok: [f5] => (item=http_pool) => {
   "msg": "http_pool"
}

TASK [Store pool name in a variable] *******************************************
ok: [f5] => (item=None)
ok: [f5]

TASK [Show members belonging to pool http_pool] ********************************
ok: [f5] => (item=node1:80) => {
   "msg": "node1:80"
}
ok: [f5] => (item=node2:80) => {
   "msg": "node2:80"
}

TASK [Disable ALL pool members] ************************************************
changed: [f5] => (item=node1:80)
changed: [f5] => (item=node2:80)

PLAY RECAP *********************************************************************
f5                         : ok=6    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Solution

The finished Ansible Playbook is provided here. Click here disable-pool-member.yml.

Verifying the Solution

To see the Disabled Pool Nodes, login to the F5 load balancer with your web browser.

  • BIG-IP - (In UDF Console –> Components –> BIG-IP –> Access –> TMUI) - This will popup a webpage to access the F5 Login Page

    • Login to the BIG-IP instance

      • username: admin

      • password: found in the inventory hosts file

  • The pool will now show two members (node1 and node2) with both nodes are disabled. Click on Local Traffic-> Pools –> Click on http_pool –> to get more granular information. Click on the Members tab in the middle to list all the Members.

    f5disabled1

    f5disabled2

You have finished this exercise.