Task7: Attach an ASM Policy dynamically using a Jenkins pipeline

1. Create a new Task

Create a new task : task7 as a pipeline.

../_images/image031.png

Click OK.

Check the box This project is parameterized and add a String Parameter called : appName.

We can also put a default value: myApplication And a shot description for this field: * Please enter your application name*

../_images/image032.png
At the bottom of the page we will configure the pipeline with the following definition:
../_images/image33b.png

Then save.

2. Run your task

You can now run the Jenkins build by clicking on the Build with Parameters button

../_images/image034.png

You can use the myAppTask4 application name as a variable so you will attach the Web Application Firewall policy to this related existing Virtual Server.

When the pipeline is executed, click on the latest step of your pipeline to approve the deployment. This click is completely useless but We had to make this lab a little bit tricky, right?

What this pipeline does is to:
  1. clone a Git Repo where is defined a new Ansible role called fch.attachWAF
  2. copy this role in your Ansible roles directory
  3. Run the fch.attachWAF role so it can grab an F5 WAF Policy from a URL, send it to your bigIP and attach it to a Virtual Server.

You can have a look at the code and the YAML files of the role at : https://github.com/fchmainy/fch.attachWAF