Exercise 3.2 - Deleting a Web Application

Read this in other languages: uk English, japan 日本語.

Table of Contents

Objective

Demonstrate deleting a Web Application with AS3 and the uri module.

Guide

Step 1:

Using your text editor of choice create a new file called delete.yml:

vim and nano are available on the control node, as well as Visual Studio and Atom via RDP

Step 2:

Enter the following play definition into delete.yml:

---
- name: LINKLIGHT AS3
  hosts: lb
  connection: local
  gather_facts: false

Step 3

Append the following to the delete.yml Playbook.

  tasks:
    - name: PUSH AS3
      uri:
        url: "https://{{ ansible_host }}:8443/mgmt/shared/appsvcs/declare/WorkshopExample"
        method: DELETE
        status_code: 200
        timeout: 300
        body_format: json
        force_basic_auth: true
        user: "{{ ansible_user }}"
        password: "{{ ansible_password }}"
        validate_certs: false
      delegate_to: localhost

There is only three parameters that have changed from the previous exercise.

Step 4

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

[student1@ansible ~]$ ansible-navigator run delete.yml --mode stdout

Playbook Output

The output will look as follows.

[student1@ansible ~]$ ansible-navigator run delete.yml --mode stdout

PLAY [LINKLIGHT AS3] **********************************************************

TASK [PUSH AS3] ***************************************************************
ok: [f5]

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

Solution

The finished Ansible Playbook is provided here for an Answer key. Click here: delete.yml.

Login to the web UI and make sure the Partition is removed.


You have finished this exercise. Click here to return to the lab guide