Hello and welcome to our series on using Oracle Linux Automation Manager.
This video focuses on setting up and using the Oracle Cloud Infrastructure Ansible Collection.
This collection provides an easy way to provision and manage resources
in the Oracle Cloud using Ansible.
So let's get started.
The first thing we need to do is address each of our prerequisites.
These include a running instance of Oracle Linux Automation Manager, a git repository for our
SCM-based project, an Oracle Cloud Infrastructure account, a user in that account with permissions
for working with resources in a compartment, and that accounts credentials and OCID information.
Details for gathering the Oracle Cloud Infrastructure Ansible Collection prerequisites
can be found in the Oracle Cloud documentation shown.
[https://docs.oracle.com/en-us/iaas/Content/API/Concepts/devguidesetupprereq.htm]
Before configuring our Oracle Linux Automation Manager instance,
let's discuss our git project used in the demonstration.
The git project should reside in a repository, such as GitHub or GitLab,
accessible directly or via proxy from the Oracle Linux Automation Manager instance.
As for how to verify access and use git, those topics are outside the scope of this video.
Next, we need to cover the layout of our project to ensure the demo works.
Our project directory contains a collections directory with a
specified requirements.yml file and two playbooks.
The requirements.yml file contains a list of collections to pull from Ansible Galaxy.
These collections are then made available to the running playbooks.
As for the playbooks, the first installs the Oracle Cloud Python SDK,
and the other will get the OCI Object Namespace from our Oracle Cloud tenancy.
With the git project layout explained, access our running Oracle Linux Automation
Manager by logging into the user interface using your browser and admin credentials.
Navigate under Resources and click Credentials.
Click the green plus button and enter Ansible Galaxy for the new credential name.
Next select Default for the Organization.
For Credential Type, click the search icon next to the text field.
Then type Ansible in the search box of the pop-up dialog and hit enter.
Select Ansible Galaxy/Automation Hub API Token from the list and click the green Select button.
The Ansible Galaxy credentials are used to set the order in which Oracle Linux Automation
Manager downloads roles/collections using the ansible-galaxy command.
Enter the public URL for the Ansible Galaxy server in the Galaxy Server URL text field.
[ https://galaxy.ansible.com ]
Review the entries and click the Save button.
With the Ansible Galaxy credential created, now assign it within our Default Organization.
This assignment is required to enable the download of the
Oracle Cloud Infrastructure Ansible Collection from our git project.
Navigate under Access and click Organizations.
Then select the Default Organization.
Search and select tower as the Instance Group.
Then, search and select the newly created Galaxy credential for the Galaxy Credentials field.
Review the choices and click the Save button.
Now navigate back to Resources and Credentials
to create a credential for Oracle Cloud Infrastructure.
[ This new credential type was added as of version 1.0.1. ]
Click the green plus button.
Enter OCI for the new credential name, and enter Default for the Organization.
Then click the search icon next to Credential Type.
Type Oracle in the search box of the pop-up dialog and hit enter.
Select Oracle Cloud Infrastructure and click the select button.
The screen will refresh and display a list of required fields for the new credential,
such as the User OCID, Tenant OCID, and Region.
Enter the requested information.
The Private User Key is the private key file used when generating your Oracle Cloud Users API Key.
Details on gathering this information are outside this video's scope
and available as part of the Oracle Cloud Infrastructure documentation.
Review the entries and click the Save button.
The OCID and private key values will be shown
as encrypted because the field definition is set as a secret.
Fields of this type can be modified by clicking the replace button next
to the field but are not viewable once saved.
With the credentials created, we now need an Inventory.
Navigate to Inventories and click the green plus button.
Select Inventory from the drop-down list of values.
Since the Oracle Cloud Infrastructure Ansible Collection uses localhost for its Ansible
connection, enter Localhost for the Inventory name and select Default for the Organization.
Click the Save button, and we're done with the Inventory.
The last two steps are to create a Project based on our git repository
and then a Job to launch the playbook.
Details to complete these are available as part of our Getting Started Series
in "Projects and Inventories" and "Creating Job Templates."
Navigate to and create a new Project.
Name it OCI Project and then assign the SCM URL.
After project creation, the Project will start to sync.
The SCM Update job summary shows the tasks fetching the galaxy collections
based on the requirements.yml file defined within our git repository.
The output shows it ran correctly, and the change indicates the collection was pulled successfully.
Lastly, navigate to Template and create a new Job Template.
Name it OCI Template, with a Job Type of Run and an Inventory of Localhost.
Then select the OCI Project and the get_oci_object_namespace.yaml playbook.
Click the search icon under Credentials.
Select Oracle Cloud Infrastructure from the Credential Type drop-down list-of-values
and then the OCI credential created earlier.
Review and click the Save button.
Now Launch the Job from the Templates list by clicking the rocket icon.
The Job Details appear, showing the playbook output on the right.
This playbook gathers the namespace for our tenancy using the Oracle
Cloud Infrastructure Ansible Collection modules.
The task eventually reports back with ok and displays the tenancy's namespace.
With the Job status also showing Successful, we have completed our demonstration.
Now, try on your own to expand this project
and deploy a new Oracle Linux instance to your compartment.
Actually, that sounds like a good topic for a future video.
Thank you for watching.
For additional information on Oracle Linux Automation Manager,
access the Oracle Linux Documentation or Oracle Linux Learning Library.