How to Create Ansible Custom Job in Spinnaker
Last updated
Last updated
How to configure and set up Ansible stage in Spinnaker as a custom stage job
How to execute Ansible playbooks through.
Understanding of spinnaker and spinnaker custom job.
Running spinnaker with Kubernetes cluster account configured in it.
Get detailed information about Spinnaker Custom Job.
The custom stage architecture is shown in the image below:
Follow the steps given below:
Create the configmap with the name ansible-config which will be mapped in orca-loca.yml. The configmap name can be anything as per your choice. In this document we are using the name as ansible-config. configmap is available here.
Note: mention your namespace in configmap.
2. Apply the configmap as shown below:
After applying, check whether the configmap is created using the command below:
3. Pass the credentials in k8s secrets where you will be setting the git username, password, Ansible node user and password. Use the following command to create the secrets and add appropriate credentials:
In the above command, ansible-secret is the name of secrets in k8s will be mapped in orca-local.yml in manifest. Here we are using secretname as ansible-secret, you can use any name as per your choice.
Once done, check whether it is created or not using the following command:
4. Create orca-local.yml file in /home/spinnaker/.hal/default/profiles which is in Halyard pod. If it already exists you can add the content below except the first three lines. orca-local.yml is available here.
Apply the changes to reflect in Spinnaker UI using the following command:
Ansible playbook - For sample playbook which creates a directory. Sample playbook is available here.
Note:- Specify hosts name in the playbook.
Inventory file - For sample inventory file. Sample inventory is available here.
Note:- Specify hosts name mentioned in Playbook and server IP.
Follow the steps given below:
Create new pipeline and create a stage here where ansiblejob is located in the drop-down list and select the ansibleJob as shown below:
2. It will ask for the repo URL, ansible file location and inventory file. Mention the entire file path from the repo and the other details. Refer to the image below:
3. Save and run the pipeline.