Ansible
Last updated
Last updated
Ansible is a configuration tool for automation. Ansible stage can configure the node machine with the configuration as per ansible playbooks.
To configure and use Ansible custom stage, you should have prior knowledge of spinnaker and spinnaker custom stage job.
You must have a running spinnaker with a Kubernetes cluster account configured in it. For more information on spinnaker custom job, refer here.
The Ansible custom stage architecture is shown in the image below:
Execute the following steps to configure Spinnaker with Ansible custom stage.
Pass the credentials in k8s secrets where you will be setting the Git Username, Git Password, Ansible Node user, and Password. Use the following command to create the secret and add appropriate credentials.
In the above command, ansible-secrets is the name of secret in k8s which will be mapped in orca-local.yml in the manifest.
2. Once you run the above command, check whether the secret is created or not by using the following command:
Note: Ansible stage configuration is stored in the orca-local.yml file in the path /home/spinnaker/.hal/default/profiles which is in Halyard pod. A dependent configmap with the name ansible-config is already configured with ISD.
Spinnaker UI prerequisites for Ansible custom stage job are as follows:
Ansible Playbook: A sample playbook which creates a directory is shown below.
Note: Specify the host's name in the Playbook.
2. Inventory file: A sample inventory file is shown below.
Note: Specify the host's name mentioned in the Playbook, and the server IP address.
Once the spinnaker is configured with Ansible Custom Stage, the "Ansible-OPsMx" stage should be available in the pipeline configuration.
To add “Ansible-OPsMx” stage to your pipeline follow the steps below:
Go to your application and click “Pipeline builder” and click “Add Stage” and then select “Ansible-OPsMx” stage from the drop-down menu as shown below.
2. Now the configuration screen appears to provide the required parameters.
Enter the following parameters on the above configuration screen:
Git repo: Provide GitHub clone url without https://
Ansible file: Provide the Ansible file location in the Git repo.
Inventory File: Provide the inventory file location in the Git repo.