In this exercise, we’re going to create a host entry in Ansible Controller for our edge device. Instead of pointing to a specific IP address or hostname, we’ll leverage the ssh service that we created using the RHSI CLI.
For a refresher on how to access Ansible Controller, review exercise 1.5.
Access the web interface of Ansible Controller, and navigate to Resources > Inventories, where two inventories have been pre-populated. Select the Edge Devices
inventory, and on the Hosts
tab, click Add
.
Give the host a descriptive name, such as: student$(YOUR-STUDENT-NUMBER)-edge-device
. When complete, hit the Save
button.
By default, Controller will attempt to resolve the name of the host and connect to the resolved IP address. Normally, that would be a sane way to contact hosts, however our connectivity is run through RHSI.
To force controller to establish a connection over the RHSI link, we’ll need to grab the service DNS name from OpenShift:
The Hostname
under Service routing
on the right hand side is the information we need. Copy this to your clipboard.
Now, back in Ansible Controller, the Host details
page for our newly created host should be displayed. Select the Edit
button, and in the Variables
box, enter the following information:
---
ansible_host: PASTE-IN-SERVICE-HOSTNAME
For example:
Click Save
when done.
A few notes:
ansible_host
is a “magic” variable that Ansible uses as what to connect to. When this isn’t defined, it attempts to resolve the name of the host, or in ansible vars: inventory_host
.Navigation
Previous Exercise | Next Exercise |