Exercise 1.2 - Adding nodes to F5 BIG-IP

Objective

Demonstrate use of the BIG-IP node module to add two RHEL (Red Hat Enterprise Linux) web servers as nodes for the BIG-IP load balancer.

Guide

Step 1:

Examine the bigip-node.yml in the VSCode editor. Expand in the Explorer (f5-bd-ansible-labs –> 101-F5-Basics –> 1.2-add-node):

Examine the Code

A loop will repeat a task on a list provided to the task. In this case it will loop twice, once for each of the two web servers.

  • The name: CREATE NODES is a user defined description that will display in the terminal output.

  • The bigip_node: is the module for adding/modifying/deleting nodes on the BIG-IP. Everything except loop is a module parameter defined on the module documentation page.

  • 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.

  • The host: "{{hostvars[item].ansible_host}}" parameter tells the module to add a web server IP address already defined in our inventory.

  • The name: "{{hostvars[item].inventory_hostname}}" parameter tells the module to use the inventory_hostname as the name (which will be node1 and node2).

  • The loop: tells the task to loop over the provided list. The list in this case is the group web which includes two RHEL hosts.

Step 2:

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

cd ~/f5-bd-ansible-labs/101-F5-Basics/1.2-add-node/

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 bigip-node.yml --mode stdout

Playbook Output

The output will look as follows.

[rhel-user@ede... 1.2-add-node]$ ansible-navigator run bigip-node.yml --mode stdout

PLAY [BIG-IP SETUP] ************************************************************

TASK [CREATE NODES] ************************************************************
changed: [f5] => (item=node1)
changed: [f5] => (item=node2)

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

Solution

The finished Ansible Playbook is provided here. Click here: bigip-node.yml.

Verifying the Solution

To see the configured 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 list of nodes can be found by navigating the menu on the left. Click on Local Traffic-> then click on Nodes.

    f5web

You have finished this exercise.