Configure Ansible in Pipeline

User can now select an Ansible playbook to execute in sequence in a pipeline step. Ansible server will execute the playbook file located within an SCM repository. Prior to this setup, Ansible tool must be successfully configured and registered in Opsera’s Tool Registry.

Workflow

In this section:

  • Register Ansible Tool

  • Configure Ansible Tool

  • Set up Ansible in Pipeline

Register Ansible Tool

  1. Login to Opsera, and navigate Products >Tool Registry.

  2. Click + New Tool.

  3. Locate the Ansible tool and click Select Tool. This will set the tool Identifier to Ansible.

  4. In the Create New Tool form, enter the required tool details and click Create.

Configure Ansible Tool

  1. Navigate to Tool Registry and open the saved Ansible tool.

  2. Click Connections tab to add configuration details.

  3. Provide values from Ansible for the following:

  • Host Name

  • Server Port

  • User Name

  • Ansible Public Key Path

4. Click Save.

This connects the tool to your existing playbooks in SCM and will now allow them to execute in your pipeline. Follow the next steps for pipeline configuration.

Configure Ansible Pipeline

  1. Once the pipeline step has been created with Ansible as the Tool Identifier, click on the gear icon in pipeline step to configure.

  2. Provide values for the following fields:

  • Ansible Tool - Select a configured Ansible Tool from Tool Registry. Confirm configuration in Connections is successful before proceeding with configurations. Ansible server will execute the playbook file selected in the following steps.

  • SCM Service Type - Select the source control management type where the playbook file to be executed is stored. Choose from Bitbucket, Github or Gitlab.

  • SCM Tool - Select the configured source control management tool, connected to the repository where the playbook file is stored.

  • Repository - Select the repository located in the SCM where the playbook file is stored.

  • Branch - Select the branch in the repository where the playbook file is stored.

  • Playbook File Path - Enter the file path where the playbook file is stored.

  • Playbook File Name - Click below on ‘Click here to fetch file list’ to fetch playbook files from the selected file path.

    • Playbook Command Arguments - Add custom parameters passed as a runtime value. Use the following format:

      { filepath: '/tmp/ansible-tasks/', filename: 'testfile_22_09_10_04.txt', command: '-e' }

3. Select Save and run the pipeline.