Chapter 2. Using Ansible roles to automate repetitive tasks on clients
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 In the Satellite web UI, navigate to Hosts > All Hosts . Select the host and click Edit . On the Ansible Roles tab, select the role that you want to add from the Available Ansible Roles list. Click the + icon to add the role to the host. You can add more than one role. 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 In the Satellite web UI, navigate to Hosts > All Hosts . Select the host and click Edit . Select the Ansible Roles tab. In the Assigned Ansible Roles area, click the - icon to remove the role from the host. Repeat to remove more roles. 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 In the Satellite web UI, navigate to Hosts > All Hosts . Select a host. Select the Ansible Roles tab. In the Assigned Ansible Roles area, you can change the order of the roles by dragging and dropping the roles into the preferred position. 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 You must configure your deployment to run Ansible roles. For more information, see Section 1.2, "Configuring your Satellite to run Ansible roles" . You must have assigned the Ansible roles to the host. Procedure In the Satellite web UI, navigate to Hosts > All Hosts . Select the checkbox of the host that contains the Ansible role you want to run. 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 Rerun . 2.5. Assigning Ansible roles to a host group You can use Ansible roles for remote management of Satellite clients. Prerequisites You must configure your deployment to run Ansible roles. For more information, see Section 1.2, "Configuring your Satellite to run Ansible roles" . Procedure In the Satellite web UI, navigate to Configure > Host Groups . Click the host group name to which you want to assign an Ansible role. On the Ansible Roles tab, select the role that you want to add from the Available Ansible Roles list. Click the + icon to add the role to the host group. You can add more than one role. 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 You must configure your deployment to run Ansible roles. For more information, see Section 1.2, "Configuring your Satellite to run Ansible roles" . You must have assigned the Ansible roles to the host group. You must have at least one host in your host group. Procedure In the Satellite web UI, navigate to Configure > Host Groups . 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. Click Rerun to rerun a job. 2.7. Running Ansible roles in check mode You can run Ansible roles in check mode through the Satellite web UI. Prerequisites You must configure your deployment to run Ansible roles. For more information, see Section 1.2, "Configuring your Satellite to run Ansible roles" . You must have assigned the Ansible roles to the host group. You must have at least one host in your host group. Procedure In the Satellite web UI, navigate to Hosts > All Hosts . Click Edit for the host you want to enable check mode for. In the Parameters tab, ensure that the host has a parameter named ansible_roles_check_mode with type boolean set to true . Click Submit .