In this exercise, we’re going to create a playbook that does some simple initial configuration of our edge devices. This will get consumed later by a workflow so our devices are automatically configured correctly when they call home.
Our tasks in the playbook will be:
/etc/hosts
fileReturn to your code repository and create a new playbook in the playbooks
directory called initial-device-config.yml
. Enter the following contents:
---
- name: do initial device setup
hosts: all
tasks:
- name: set the system hostname
ansible.builtin.hostname:
name: "{{ inventory_hostname }}"
- name: insert line into /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
line: '{{ ansible_default_ipv4.address }} {{ inventory_hostname }} {{ inventory_hostname }}.lcl'
insertafter: EOF
Once complete, commit and push your new playbook up into Gitea.
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 | Initial Device Configuration |
Inventory | Edge Systems |
Project | Device Edge Codebase |
Execution Environment | Device Edge Workshops Execution Environment |
Playbook | playbooks/initial-device-config.yml |
Credentials |
|
Limit | |
Options |
|
Remember to click Save.
We’re not going to run this job right now, but instead leverage it in the next exercise.
Navigation
Previous Exercise | Next Exercise |