Lab3 - F5 Application Service Templates

05/21/2020 - lab time: 20 mins -

Overview

In this lab, we will leverage F5 Application Service Templates (FAST), to help streamline application deployments.

Prerequisites

  1. Access to the F5 Unified Demo Framework (UDF)
  2. Chrome browser
  3. Finished the Lab0 setup process in the UDF DevOps Base documentation

Environment

In this lab, we will deploy two HTTP applications on the F5 BIG-IP. This lab will leverage the following components and tools:

Deploy Our First Application

Ensure you have the latest version of the lab from GitHub then open the lab3 folder:

  cd ~/projects/UDF-DevOps-Base
  git pull
  cd labs/lab3

Ensure FAST is running and read:

  curl -sku admin:$bigip_pwd  https://10.1.1.6/mgmt/shared/fast/info | jq

Exploring FAST templates

FAST provides some default templates to get you started:

  • HTTP/HTTPS
  • TCP
  • UDP
  • Simple WAF

In this lab, we will take a look at the HTTP templates.

  1. Create lab3a.json, this will be our POST payload:
     {
       "name": "bigip-fast-templates/http",
       "parameters": {
         "tenant_name": "demo",
         "app_name": "lab3a",
         "virtual_address": "10.1.20.10",
         "virtual_port": 80,
         "enable_pool": true, 
         "pool_members": ["10.1.10.5", "10.1.10.10"],
         "pool_port": 80,
         "enable_snat": false, 
         "enable_tls_server": false, 
         "enable_tls_client": false, 
         "make_http_profile": false, 
         "enable_persistence": false, 
         "enable_acceleration": false, 
         "enable_compression": false, 
         "enable_multiplex": false
       }
     }
    

In this YAML file, we’re setting the following variables:

  • Tenant Name
  • App Name
  • Virtual Address
  • Virtual Port
  • Pool members
  • Pool port
  • everything else is a required attribute of this template
  1. Post the payload:
  # replace with your BIG-IP password
  export bigip_pwd=enteryourpassword

  fast_task_id=$(curl -sku admin:$bigip_pwd  https://10.1.1.6/mgmt/shared/fast/applications -X POST --header "Content-Type: application/json" -d "@lab3a.json" | jq '.message[0].id' -r)
  1. Check the response:
  curl -sku admin:$bigip_pwd  https://10.1.1.6/mgmt/shared/fast/tasks/$fast_task_id
You should see a 200 response if everything was successful.

Congratulations, you have now deployed your first FAST application!!

One of the advantages FAST templates have over native AS3 is that FAST manages compiling all the applications of a tenant together when building the AS3 declaration. For customers that are new to automation, FAST provides an ideal starting point. We’ll take a look at this in the next section.

Deploy Our Second Application

A unique feature of FAST is that it treats each application separately, and it will handle stitching everything together to build a proper AS3 declaration.

In this exercise, we will deploy our second application on port 8080.

  1. Create lab3b.json, this will be our POST payload:
  {
    "name": "bigip-fast-templates/http",
    "parameters": {
      "tenant_name": "demo",
      "app_name": "lab3b",
      "virtual_address": "10.1.20.10",
      "virtual_port": 8080,
      "enable_pool": true, 
      "pool_members": ["10.1.10.5", "10.1.10.10"],
      "pool_port": 8080,
      "enable_snat": false, 
      "enable_tls_server": false, 
      "enable_tls_client": false, 
      "make_http_profile": false, 
      "enable_persistence": false, 
      "enable_acceleration": false, 
      "enable_compression": false, 
      "enable_multiplex": false
    }
  }

Everything in this data file looks similar to lab3a except for the virtual_port and the pool_port. You could further simplify this type of deployment by building your own templates that remove some of the common attributes that do not apply to your environment.

  1. Post the payload:
  fast_task_id=$(curl -sku admin:$bigip_pwd  https://10.1.1.6/mgmt/shared/fast/applications -X POST --header "Content-Type: application/json" -d "@lab3b.json" | jq '.message[0].id' -r)
  1. Check the response:
  curl -sku admin:$bigip_pwd  https://10.1.1.6/mgmt/shared/fast/tasks/$fast_task_id

Testing

For testing we will use Chef InSpec. This tool is commonly used in automated deployments and offers a wide variety of both infrastructure and application testing options.

Test that the deployment was successful:

cd ~/projects/UDF-DevOps-Base/labs/lab3
inspec exec test/app

Cleanup

To cleanup the environment, we’ll remove the two applications we deployed:

curl -sku admin:$bigip_pwd -X DELETE https://10.1.1.6/mgmt/shared/fast/applications/demo/lab3a
curl -sku admin:$bigip_pwd -X DELETE https://10.1.1.6/mgmt/shared/fast/applications/demo/lab3b