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.
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.
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 | |
Limit | |
Options |
Remember to click Save.
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.
Navigation
Previous Exercise | Next Exercise |