1
votes

After being googling enough, I thought to seek help from here.

I have an ansible playbook which works fine and does the job on a Linux host as well as from Jenkins as a Job.

What I want to do is and this is basically the company I work for is using Azure DevOps formerly known as VSTS.

The idea I have in mind is Azure DevOps should provision environment with Ansible or even Terraform. I have both codes and both do the job.

For now, I want Azure DevOps to run my playbook, later on, it would a terraform code doing provisioning and Ansible installing software and doing configuration management.

My question is how to create a job in Azure DevOps for Ansible or for Terraform.

I had a look at UI and have no idea how to get started.

Any guidance would be greatly appreciated.

Thank you

2

2 Answers

1
votes

The basics are using the UI to generate you yml:

  1. Create a new pipeline
  2. Select Classic Editor
  3. Select your repo and click continue
  4. Click 'create empty job'
  5. Name you pipeline and select a host
  6. Select on Agent Job 1 and click on the +
  7. Search for Ansible and install the extention
  8. Add the Ansible job and fill out the parameters as required

If you are using the hosted agent then you would possibly need to run Asnible on a separate server. Ive also found the sudo tick box doesn't work as expected

0
votes

You would just use a script step and use something like ansible-playbook playbook.yml or terraform plan`terraform apply`.

You might need to create steps to update ansible\terraform to desired versions (each time build runs) if you are using hosted agent.