Workshop Exercise 5.4 - Deploy Containerized Application

Table of Contents

Objective

In this exercise, we’ll create a playbook to run our role, create a job template for it in Ansible Controller, and deploying the application – all via automation.

Step 1 - Creating a Playbook

Return to your code repo and create a playbook in the playbooks directory called deploy-containerized-app.yml with the following contents:

---

- name: deploy our containerized application
  hosts: all
  roles:
    - ../roles/deploy_containerized_app

Once complete, be sure to commit push your changes up to the git server.

Step 2 - Creating a Job Template

Note

Be sure to sync your project in Controller before attempting to create this job template.

In the Controller WebUI. under Resources > Templates, select Add > Add job template and enter the following information:

Parameter Value
Name Deploy Containerized Application
Inventory Edge Systems
Project Device Edge Codebase
Execution Environment Device Edge Workshops Execution Environment
Playbook playbooks/deploy-containerized-app.yml
Credentials
  • ✓ Device Credentials
  • Limit
  • ✓ Prompt on launch
  • Remember to click Save.

    Step 3 - Running the Job Template

    Now that the job template has been created, click the Launch button if you are still within the Deploy Containerized Application Job Template. Otherwise, click on the rocket ship on the Templates page to launch the job template. Enter your device name when prompted on the limits page. Monitor the output for any errors or issues. However, hopefully the job executes successfully.

    As a reminder, the output of jobs can be reviewed on the Jobs tab.

    Once the playbook completes, visit http://$(your-device-ip-address):1881/ui to view the running application.

    Note

    For virtualized edge devices, you’ll need to use SSH tunneling or just curl the port to check for a response.

    Similar to the bare metal deployment of the application, the automation could be added to the end of our provisioning workflow as soon as a device calls home.

    Solutions

    Deploy Containerized Application Job Template

    Containerized App Running


    Navigation

    Previous Exercise Next Exercise

    Click here to return to the Workshop Homepage