Get Started with Oracle Linux Automation Manager

3
0
Send lab feedback

Get Started with Oracle Linux Automation Manager

Introduction

Oracle Linux Automation Manager provides features allowing your organization to effectively manage infrastructure configuration through a browser-based user interface.

By the end of this tutorial, you'll have a working Oracle Linux Automation Manager installation ready to run more complex playbooks.

Objectives

In this lab, you'll learn how to:

  • Use the WebUI
  • Review the Default Organization
  • Add a User
  • Setup an Inventory
  • Setup a Credential
  • Create a Project
  • Setup a Job Template
  • Run the Job

Prerequisites

Login to the WebUI

Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.

Information: The free lab environment deploys a running single-host Oracle Linux Automation Manager. The deployment takes approximately 15 minutes to finish after launch. Therefore, you might want to step away while this runs and promptly return to complete the lab.

  1. Open a terminal and configure an SSH tunnel to the deployed Oracle Linux Automation Manager instance.

    ssh -L 8444:localhost:443 oracle@<hostname or ip address>

    In the free lab environment, use the IP address of the ol-node VM as it runs the Oracle Linux Automation Manager deployment.

  2. Open a web browser and enter the URL.

    https://localhost:8444

    Note: Approve the security warning based on the browser used. For Chrome, click the Advanced button and then the Proceed to localhost (unsafe) link.

  3. Login to Oracle Linux Automation Manager with the Username admin and the Password admin created during the automated deployment.

    olam2-login

  4. After login, the WebUI displays.

    olam2-webui

Oracle Linux Automation Manager's centralized web UI engine allows for securely and efficiently controlling and managing your infrastructure.

The product is based on the open-source Ansible and AWX projects, providing a visual dashboard for role-based access control, inventory management, and scheduling jobs.

  1. Along the left-hand side of the WebUI, there is a navigation menu allowing quick access to Projects, Inventories, Templates, and Jobs.

    olam2-nav-menu

  2. Click the menu icon at the top of the menu to collapse and hide the menu. Click it again to expand and unhide the menu.

    olam2-nav-hide

  3. At the bottom of the navigation menu is the Settings menu item.

    olam2-settings-menu

  4. Select this item to navigate to the Settings page.

    olam2-settings-page

    The Settings page gives access to alternative Authentication settings and settings for Job, System, and the User Interface.

  5. Click the Dashboard menu item in the navigation menu.

    olam2-dashboard-page

    Clicking this menu item returns you to the main dashboard view showing current Job Status, Recently Used Templates, and Recent Job Runs.

    Note: The list of recent items only appears after using templates or running jobs.

Review the Default Organization

Organizations sit at the top of the role-based pyramid and are a logical collection of users, teams, projects, and inventories.

  1. In the navigation menu, click Organizations.

    olam2-org-menu

    The main window displays a list of the available organizations.

    olam2-org-page

    Oracle Linux Automation Manager automatically creates a Default organization available to all users.

  2. View the Default organization by clicking the organization's name.

    olam2-org-default-details

    For the purposes of this lab, we'll use the Default organization as is.

  3. (Optional) If needing to make changes to the Default organization, click the Edit button.

    Make any desired changes and then click the Save button.

    olam2-org-default-edit

Administrators needing information about creating new organizations should see the Oracle Linux Automation Manager Users Guide .

Add a User

The WebUI navigation menu Access section manages the default user administration of Oracle Linux Automation Manager. The user administration is role-based and consists of a combination of Organizations, Users, and Teams. Adding users is possible from the Users navigation menu item or directly from within an organization.

Find an Organization's Users

  1. Click the Access tab on the Default organization's details page.

    olam2-org-default-details

  2. The Default organization's access page shows the admin user. After installation, the admin user is the only user in Oracle Linux Automation Manager and is part of the Default organization.

    olam2-org-default-access

  3. From this page, you can add a new user by clicking the Add button or view the admin user details by clicking the admin user name.

  4. View the admin user by clicking the admin user's name.

    Clicking this item displays the user details page.

    olam2-user-details

  5. Click the Edit button to show the Edit Details page.

    This page allows editing the user's email, password, role, and other details.

    olam2-user-edit-details

    Important: Do not change the admin user's type (role). Oracle Linux Automation Manager requires at least one System Administrator. Changing the admin user type without having another user with the System Administrator role will lock you out of administrating Oracle Linux Automation Manager.

    Click Cancel.

Add a User

  1. In the navigation menu, click Users.

    olam2-user-menu

    The main window displays a list of available users.

    olam2-user-page

  2. Click the Add button to create a new user.

  3. Add the required details on the Create New User page.

    olam2-user-create

  4. Click the Save button.

  5. The new user details page displays.

    olam2-user-details-new

Setup an Inventory

An inventory is a group of hosts managed by Oracle Linux Automation Manager. Users leverage an inventory to automate host orchestration by running playbooks.

  1. View the current list of inventories by clicking the Inventories navigation menu item.

    olam2-inv-menu

    The main window shows the message No Inventories Found on a new installation.

  2. Add a new inventory by clicking the Add button.

    Select Add Inventory from the drop-down menu.

    olam2-inv-page

  3. Add the requested details to the Create new inventory page.

    olam2-inv-create

  4. Click the Save button when finished.

  5. The new inventory details page displays.

    olam2-inv-details

  6. Click the Hosts tab from the inventory details page.

    olam2-inv-hosts

    The page displays a list of hosts that are associated with the inventory. The message No Hosts Found appears on a newly created inventory until adding the first host.

  7. Click the Add button.

    The Create new host page displays.

    olam2-inv-host-create

  8. Enter a hostname or IP address for a host in the Name text field.

    When using hostnames, they must be resolvable on the network where the Oracle Linux Automation Manager resides.

    olam2-inv-host-create2

    For the free lab environment, enter the public IP address of the git-server from the Luna Lab Resources page. This server is an additional Oracle Linux instance that deploys with the free lab environment.

  9. Click the Save button.

    The main window displays the Host details page and summarizes information about the newly created host we added to the inventory.

    olam2-inv-host-detail

Setup a Credential

Credentials authenticate a user within Oracle Linux Automation Manager against machines using passwords and SSH keys, sync inventory sources, and import playbooks from version control systems such as GitHub. Each credential may contain usernames, passwords, private keys, or other security-related information.

  1. Navigate within the menu and click Credentials.

    olam2-cred-menu

    The Credentials page displays a No Items Found message on a newly installed system.

    olam2-cred-page

  2. Click the Add button.

    The Create New Credential page displays.

    olam2-cred-create

  3. Enter the requested information.

    olam2-cred-create2

    Select the Machine credential type in the Credential Type list of values.

    olam2-cred-type

    The Create New Credential page expands to allow entering the information for the specific hosts or machines.

    olam2-cred-type-detail2

    Enter a Username of oracle and browse for the SSH Private Key. Clicking the Browse... button displays an Open File dialog window.

    olam2-open-file

    Select Home in the Open File dialog menu.

    Right-click on the main window of the dialog and then select Show Hidden Files.

    olam2-show-hide

    Then select the .ssh folder and the id_rsa file. Clicking the Select button causes the contents of the private key file to copy into the SSH Private Key dialog box. Scroll down and click the Save button.

  4. The main window updates to show the credential Details page.

    This page provides a summary of the newly created credential.

    olam2-cred-detail-summary

Create a Project

A Project is a compilation of playbooks grouped based on their actions or the hosts with which they interact.

We have multiple ways to manage these playbooks using Oracle Linux Automation Manager, such as manually or using a git-based source control management (SCM) solution such as GitHub or Gitlab.

Use Source Control

While Oracle Linux Automation Manager allows storing playbooks locally on the same server, storing them within a supported source control server such as Git is best practice.

To help, Oracle provides a collection of ansible playbooks on GitHub for use with Oracle Linux Automation Manager or Oracle Linux Automation Engine.

But what if you only needed a single playbook or wanted to customize a playbook to your environment?

That is where having your self-hosted Git server or personal online repository such as GitHub comes in handy.

For this tutorial, the free lab environment deploys a standalone Git server to the git-server VM.

  1. Open a new terminal.

    Note: In the free lab environment, do not ssh to a server for this step, as we'll directly use the provided Luna desktop.

  2. Clone the Oracle Samples Anisble Collections repository.

    git clone https://github.com/oracle-samples/ansible-collections.git

    Cloning the repository creates the ansible-collections directory in the Luna Users home directory containing the requested repository contents.

  3. Create a new local project directory.

    mkdir hello-world
  4. Change into the new project's working directory.

    cd hello-world
  5. Create a README file for the new project.

    echo "# First sample project" > README.md
  6. Add a sample playbook.

    Copy the hello-world.yml playbook from the Oracle Samples Ansible Collection repository into the new project.

    cp ../ansible-collections/playbooks/OL_Admin/hello-world.yml .
  7. Initialize the project's working directory into a Git repository.

    Before initializing the repository, you need to perform some Git first-time setup steps.

    1. Set the default branch name used when initializing a project.

      git config --global init.defaultBranch main
    2. Set your Identity.

      Note: The email and name below are examples within this tutorial. Using your actual email and name outside this tutorial is essential, and this information gets immutably baked into each of your commits.

      git config --global user.email johndoe@example.com
      git config --global user.name "John Doe"
      
    3. Initialize the directory as a local Git repository.

      git init

      The command returns that it Initialized the empty Git repository.

  8. Check the state of the working directory and project staging area.

    git status

    The state of the local repository indicates two untracked files, README.md and hello-world.yml.

  9. Add and track the new files in the staging area.

    git add --all

    The --all option adds all untracked and changed files to the staging area.

  10. Commit the changes currently in the staging area.

    git commit -m 'initial commit'

    The -m option allows adding a comment to the committed changes.

  11. Create and initialize the remote Git repository.

    A remote is a shared repository used by all project contributors and stored on a code-hosting service like GitHub or a self-hosted server.

    ssh git@<hostname or ip address of Git server> "git init --bare /git-server/repos/hello-world.git"

    Use the public IP address shown for the git-server VM on the free lab environment's Luna Lab Resources page.

    Accept the ECDSA key fingerprint to continue.

    Example Output:

    [luna.user@lunabox hello-world]$ ssh git@130.61.79.231 "git init --bare /git-server/repos/hello-world.git"
    The authenticity of host '130.61.79.231 (130.61.79.231)' can't be established.
    ECDSA key fingerprint is SHA256:EBdUMoRul8Yd8SP8dI003NE8SXdbsHvhILAtsw9YNf0.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '130.61.79.231' (ECDSA) to the list of known hosts.
    Initialized empty Git repository in /git-server/repos/hello-world.git/
  12. Add the new remote repository connection record.

    After adding the remote to the local repository, you can use it as a shortcut in other Git commands.

    git remote add origin git@<hostname or ip address of Git server>:/git-server/repos/hello-world.git

    The IP address is the address of the remote Git server, and the path after the colon is the repository's location on the remote Git server.

  13. Verify the newly added connection record.

    git remote -v

    Example Output:

    [luna.user@lunabox hello-world]$ git remote -v
    origin	 git@130.61.79.231:/git-server/repos/hello-world.git (fetch)
    origin	 git@130.61.79.231:/git-server/repos/hello-world.git (push)

    The output shows the connection record origin pointing to the remote Git repository location for both fetch and push Git commands.

  14. Push local repository changes to the remote repository.

    git push origin main

    Example Output

    [luna.user@lunabox hello-world]$ git push origin main
    Enumerating objects: 4, done.
    Counting objects: 100% (4/4), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (4/4), 586 bytes | 586.00 KiB/s, done.
    Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
    To 130.61.79.231:/git-server/repos/hello-world.git
     * [new branch]      main -> main

With the hello-world.yml sample code available on the remote Git repository, it is possible to use it in an Oracle Linux Automation Manager Project.

Add Source Control Credential

Before creating a project, we need to add the credentials for the Git server to Oracle Linux Automation Manager. These credentials allow Oracle Linux Automation Manager to pull the project securely over an ssh connection as the git user.

This step is unnecessary for a public repository where the project is available without authentication over the HTTPS protocol.

  1. Open the browser tab or window logged into Oracle Linux Automation Manager.

  2. Navigate and click on Credentials in the navigation menu.

  3. Click the Add button to add a new credential.

  4. Enter the required information and select Source Control from the Credential Type list of values.

    olam2-cred-source

  5. The page expands, showing the Type Details.

  6. Enter a Username of git and select the SCM Private Key.

    olam2-cred-source-details

    In the free lab environment, the SCM Private Key is the same id_rsa ssh private key used previously for the oracle user.

  7. Scroll down the page and click the Save button.

Create a Project

  1. Click Projects in the navigation menu.

    olam2-project-menu

  2. Then click the Add button.

    olam2-project-page

  3. Enter the requested information on the Create New Project page.

    olam2-project-new

  4. Click the search icon next to the Execution Environment list of values.

  5. In the Select Execution Environment pop-up dialog box, click the OLAM EE (latest) radio button.

    olam2-project-env

  6. Click the Select button to close the dialog box.

  7. Select Git from the Source Control Credential Type list of values.

    olam2-project-cred-type

    The Create New Project page expands to show the Type Details.

  8. Enter the Source Control URL value into the text field.

    git@<hostname or ip address of Git server>:/git-server/repos/hello-world.git

    You can click the more information icon next to this field to see sample values. This tutorial uses the same values displayed in the terminal output when running git remote -v.

  9. Enter the Source Control Credential by clicking the search icon and selecting the credential corresponding to the Source Control URL.

    olam2-project-scm-cred

  10. Review each of the additional Options.

    olam2-project-type-options

    Clicking on the more information icon next to each option provides details on its functionality.

  11. Click the Save button.

  12. The main window displays a project summary on a Details page.

    If the project can properly communicate with the Git server and pull the project, a Successful job status appears within the summary details.

    olam2-project-detail-summary

Setup a Job Template

A Job Template consists of all the parts and pieces required to run a playbook and represents the ansible-playbook command provided in the Oracle Linux Automation Engine.

  1. From the navigation menu, click Templates.

    olam2-template-menu

  2. Click the Add button on the main Templates page.

    olam2-template-page

  3. Select Add job template from the displayed list of values.

  4. Enter the requested information on the Create New Job Template page.

    olam2-template-new-job

  5. Scroll to the bottom, and click the Save button.

  6. The Detail summary page displays the new template.

    olam2-template-summary

Run the Job

With the template creation complete, we can now run the playbook.

  1. Using the breadcrumbs navigation at the top of the page, click Templates.

    olam2-template-bc

    This click returns you to the Templates overview page.

    olam2-template-list

  2. Use the rocket icon under the Actions column and launch the Hello Template job template.

    olam2-template-launch

  3. After launch, a status page displays the job output and, eventually, the results.

    olam2-template-job-output

    The playbook prints a welcome message to the screen if it runs successfully.

Summary

This welcome message confirms you have a working Oracle Linux Automation Manager installation.

For More Information

Oracle Linux Automation Manager Documentation
Oracle Linux Automation Manager Training
Oracle Linux Training Station

SSR