Workshop Exercise 4.4 - Deploy Bare Metal Application

Table of Contents

Objective

In this exercise, we’ll create a playbook to run our role, creating 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-bare-metal-app.yml with the following contents:

---

- name: deploy bare metal app to edge device
  hosts: all
  roles:
    - ../roles/deploy_bare_metal_app

Once complete, be sure to commit and push your changes up to the repo.

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 Bare Metal App
Inventory Edge Systems
Project Device Edge Codebase
Execution Environment Device Edge Workshops Execution Environment
Playbook playbooks/deploy-bare-metal-app.yml
Credentials
  • ✓ Device Credentials
  • Limit
  • ✓ Prompt on launch
  • Options
  • ✓ Privilege Escalation
  • 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 Bare Metal App 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 application running.

    Note

    For virtualized edge devices, you’ll need to use SSH tunneling or just curl the port to check for a response. Something like the following might do the trick: ssh -L 1881:ip-address-of-the-virtual-edge:1881 student{your-number}@edge-manager.tech-exchange.emea.redhat-workshops.com

    Further thoughts: The deployment of the application could be added to the end of our provisioning workflow as soon as a device calls home to simplify the setup and configuration process. We’re not going to do that here, since we’re about to tear it down and reprovision using a better methodology.

    Solutions

    Deploy Bare Metal App Job Template

    Bare Metal App Running


    Navigation

    Previous Exercise Next Exercise

    Click here to return to the Workshop Homepage