1.5. Overriding Ansible Variables in Satellite
If you run Ansible roles in Satellite, you can use Satellite to override Ansible variables for those roles.
Precedence in Overriding Variables
If you use an Ansible role to run a task as a user that is not the Effective User
, there is a strict order of precedence for overriding Ansible variables. To ensure that the variable that you override follows the correct order of precedence, see Variable precedence: Where should I put a variable? in the Ansible User Guide.
Prerequisite
You must have Ansible variables in Satellite.
To import Ansible variables, see 「Importing Ansible Variables」
To create Ansible variables, see 「Creating Ansible Variables」
The following procedure makes reference to hosts and host groups. For more information about hosts and host groups, see the Managing Hosts guide.
Procedure
To override an Ansible variable, complete the following steps:
- In the Satellite web UI, navigate to Configure > Variables.
- Select the Ansible variable that you want to override and manage with Satellite.
- Navigate to the Default Behavior area, and select the Override check box.
- From the Parameter Type select the value type for validation. For example, a string or boolean variable.
- In the Default Value field, enter the default value that you want to use if there is no match for the variable.
- Optional: If you do not want to display the Ansible variable in plain text, select the Hidden Values check box to display the content of the variable as asterisks in the Satellite web UI.
- To save the override settings, click Submit.
To use the Ansible variable, add the variable as a parameter to your host or host group, or add the variable as a global parameter.
For a Host Group:
- In the Satellite web UI, navigate to Configure > Host Groups, and select the host group that you want to use.
- Click the Parameters tab, and in the Host Group Parameters area, click Add Parameter.
- In the Name field, add the Ansible variable name.
- From the Type list, select the type of the variable for validation.
- In the Value field, enter the value for the variable.
For a Host:
- In the Satellite web UI, navigate to Hosts > All Hosts, and on the host that you want to use, click the Edit button.
- Click the Parameters tab, and in the Host Parameters area, click Add Parameter.
- In the Name field, add the Ansible variable name.
- From the Type list, select the type of the variable for validation.
- In the Value field, enter the value for the variable.
To add as a Global Parameter:
- In the Satellite web UI, navigate to Configure > Global Parameters, and click Create Parameter.
- In the Name field, add the Ansible variable name.
- From the Type list, select the type of the variable for validation.
- In the Value field, enter the value for the variable.
- Optional: If you do not want to display the Ansible variable in plain text, select the Hidden Values check box to display the content of the variable as asterisks in the Satellite web UI.