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.

Ansible custom stage architecture

The Ansible custom stage architecture is shown in the image below:

Configure Spinnaker with Ansible custom stage

Execute the following steps to configure Spinnaker with Ansible custom stage.

  1. 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.

kubectl create secret generic ansible-secrets
--from-literal=userpassword=<USERPASSWORD> -n <namespace>

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:

# kubectl get secrets

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

Spinnaker UI prerequisites for Ansible custom stage job are as follows:

  1. Ansible Playbook: A sample playbook which creates a directory is shown below.

 - hosts: mynode
     - name: install apache2
       apt: name=apache2 update_cache=yes state=latest
       become: true
       become_user: root
     - name: start apache2
       service: name=apache2 state=started
       become: true
       become_user: root

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.

Execute Ansible Playbooks via the custom stage

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:

  1. 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.

Last updated