Exercise 2.0: 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 pool /Common/http_pool
  • Display pool member status to the terminal window
  • Store the pool members as a fact
  • Display pool member IP and port information to the terminal window
  • Forces a pool member offline

Guide

Step 1

At this point your BIG-IP will have no configuraton if you sucessfully ran exercises 1.6 and 1.7 Before running this exercise please ensure that you have working pool members by running exercises 1.2, 1.3, and 1.4

Moving to the exercise:

Using your text editor of choice create a new file called disable-pool-member.yml.

[student1@ansible ~]$ nano disable-pool-member.yml

Step 2

Enter the following play definition into disable-pool-member.yml:

- name:  Disabling a pool member
  hosts: f5
  connection: local
  gather_facts: false

Step 3

Next, add a tasks section and create a task for the objective listed above:

  • Retrieve Facts from BIG-IP for the pool /Common/http_pool

HINT: Try using the bigip_device_info module

Step 4

Next, add a task for the objective listed above:

  • Display pools available to the terminal window

HINT: Remember to use the register keyword and the ansible debug module

Step 5

Next, add a task for the objective listed above:

  • Store the pool members as a fact

HINT: An easy way to set fact variables within a Playbook dynamically is using the set_fact module

Step 6

Next, add a task for the objective listed above:

  • Display pool member IP and port information to the terminal window

HINT: Remember to use the register keyword and the debug module

Step 7

Next, add a task for the objective listed above:

  • Force Pool Member offline

HINT: Remember the bigip_pool_member module. Also remember to look at the state parameter

Step 8 Run the playbook - exit back into the command line of the control host and execute the following:

[student1@ansible ~]$ ansible-playbook disable-pool-member.yml

Solution

The finished Ansible Playbook is provided here for an Answer key. Click here: disable-pool-member.yml.

You have finished this exercise.