Chapter 2. Using Ansible Roles to Automate Repetitive Tasks on Clients

2.1. Assigning Ansible Roles to an Existing Host

You can use Ansible roles for remote management of Satellite clients.

Prerequisites

  • Ensure that you have configured and imported Ansible roles.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Select the host and click Edit.
  3. On the Ansible Roles tab, select the role that you want to add from the Available Ansible Roles list.
  4. Click the + icon to add the role to the host. You can add more than one role.
  5. Click Submit.

After you assign Ansible roles to hosts, you can use Ansible for remote execution. For more information, see Section 4.13, “Distributing SSH Keys for Remote Execution”.

Overriding Parameter Variables

On the Parameters tab, click Add Parameter to add any parameter variables that you want to pass to job templates at run time. This includes all Ansible playbook parameters and host parameters that you want to associate with the host. To use a parameter variable with an Ansible job template, you must add a Host Parameter.

2.2. Removing Ansible Roles from a Host

Use the following procedure to remove Ansible roles from a host.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Select the host and click Edit.
  3. Select the Ansible Roles tab.
  4. In the Assigned Ansible Roles area, click the - icon to remove the role from the host. Repeat to remove more roles.
  5. Click Submit.

2.3. Changing the Order of Ansible Roles

Use the following procedure to change the order of Ansible roles applied to a host.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Select a host.
  3. Select the Ansible Roles tab.
  4. In the Assigned Ansible Roles area, you can change the order of the roles by dragging and dropping the roles into the preferred position.
  5. Click Submit to save the order of the Ansible roles.

2.4. Running Ansible Roles on a Host

You can run Ansible roles on a host through the Satellite web UI.

Prerequisites

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Select the checkbox of the host that contains the Ansible role you want to run.
  3. From the Select Action list, select Run all Ansible roles.

You can view the status of your Ansible job on the Run Ansible roles page. To rerun a job, click the Rerun button.

2.5. Assigning Ansible Roles to a Host Group

You can use Ansible roles for remote management of Satellite clients.

Prerequisite

Procedure

  1. In the Satellite web UI, navigate to Configure > Host Groups.
  2. Click the host group name to which you want to assign an Ansible role.
  3. On the Ansible Roles tab, select the role that you want to add from the Available Ansible Roles list.
  4. Click the + icon to add the role to the host group. You can add more than one role.
  5. Click Submit.

2.6. Running Ansible Roles on a Host Group

You can run Ansible roles on a host group through the Satellite web UI.

Prerequisites

Procedure

  1. In the Satellite web UI, navigate to Configure > Host Groups.
  2. From the list in the Actions column for the host group, select Run all Ansible roles.

You can view the status of your Ansible job on the Run Ansible roles page. To rerun a job, click the Rerun button.

2.7. Running Ansible Roles in Check Mode

You can run Ansible roles in check mode through the Satellite web UI.

Prerequisites

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Click Edit for the host you want to enable check mode for.
  3. In the Parameters tab, ensure that the host has a parameter named ansible_roles_check_mode with type boolean set to true.
  4. Click Submit.