Lab Guide: Creating Dynamic Documentation for Azure


1. Lab Guide: Hands-On Tasks

Estimated time to complete: 20 minutes

Welcome to the third challenge. You will now generate an HTML website using the structured data gathered from your Azure environment.

First, log in to the automation controller with the following credentials.

Table 1. Login Credentials

Username

admin

Password

ansible123!

1.1. Task 1: Create the "Create Azure Cloud Report" Job Template

You will start by creating a job template that runs a playbook to generate the cloud report.

  1. Navigate to the Templates page.

    Expand the Automation Execution menu on the left. Automation ExecutionTemplates.

  2. Create a new job template.

    Click the + Create Template then scroll down and click Create job template

  3. Enter the job template details.

    Fill out the form with the following information:

    Parameter

    Value

    Name

    Create Azure Cloud Report

    Job Type

    Run

    Inventory

    Azure Inventory

    Project

    Cloud Visibility Project

    Playbook

    playbooks/cloud_report_azure.yml

    Execution Environment

    Microsoft Azure Execution Environment

    Credentials

    azure_credential AND RHEL on Azure

    To select the azure_credential, click in the text field or on the drop down icon, then select azure_ credential | Microsoft Azure Resource Manager. Same for the RHEL on Azure credential, click in the text field or on the drop down icon, then select RHEL on Azure | Machine.
  4. Save the job template.

    Click the blue Create job template button.

  5. Add the following survey question.

    Navigate to the Survey tab and click the blue Create survey question button. Configure the following question as follows:

    Parameter

    Value

    Question

    Where should the Azure Cloud report be generated?

    Answer variable name

    report_server

    Answer type

    Text

    Default answer

    reportserver

    Click Create survey question.

  6. Enable the survey.

    You must enable the survey by clicking the toggle switch at the top of the survey page. The text will change from SURVEY Disabled to SURVEY enabled.

    Survey enabled toggle

    The Ansible Playbooks for this lab are sourced from this project on GitHub.

1.2. Task 2: Launch the Job Template

Now you are ready to run the job and generate the report.

  1. Launch the job template.

    Navigate back to the Templates page. Find the Create Azure Cloud Report template and click 🚀 Launch template icon.

    Launch Job Icon

  2. Understand the playbook execution.

    This playbook uses two roles:

  3. The first role retrieves structured data for regions, virtual networks, and virtual machines.

  4. The second role creates an HTML report. It installs a web server, copies assets (CSS, images), and uses the structured data to generate a dynamic website.

  5. View the generated report. Locate the Azure Cloud Report URL from the Job Output.

    Once the job completes, navigate to the bottom of the Output tab and locate the URL. It will look similar to this: http://<IP_ADDRESS>:80

    You will see a report similar to this:

    Generated Azure cloud report

1.3. Task 3: Analyze the Report

A cloud operator can use this report to quickly gain awareness of their cloud footprint. It combines information from several info modules, which correspond to multiple Azure API calls.

Important considerations for a cloud operator include:

  • How can we identify virtual networks in Azure that are not in use and can be safely deleted?

  • Which regions are running instances versus which ones are empty?

  • Which regions have stopped instances that may turn on at any moment?


2. Conclusion

You have successfully completed this lab! We hope you enjoyed learning about how Ansible can be used to create dynamic documentation for your Azure environment.

+ Press the End button to end the lab.

3. Troubleshooting

If you have encountered an issue or have noticed something not quite right, please open an issue on GitHub.