Giter Site home page Giter Site logo

ado_ansible_yml's Introduction

ADO_Ansible_YML

Azure Devops Ansible Pipeline

ADO = Azure Devops

This is a brief guide to setting up a simple environment for utilizing ansible in an ADO YAML Pipeline to connect to a Windows VM's utilising winping as a demo to prove this works

This is a lab only !

Pre-Req's

  • Azure Devops Organization and Project for testing
  • Devops Connection to Azure with read access to all (In this example i used the service principle in the connection for accessing the keyvault and logging in to azure)
  • Agent pool (Name: Ansible) created and PAT token at the ready, information on how below.
  • terraform installed locally
  • VSCode with TF Extension and Git
  • AZ Cli or AZ PS Module
  • Azure Subscription
  • Azure Service Principle created (keep a hold of the details) guide , alt guide

Instructions

Import the repo into your test project in ADO Guide

Git clone in VS Code

Update the ado.sh file replacing all items within the <> brackets, don't forget to remove the brackets (see here for how to create PAT Tokens and here for Agent pools)

Update the ansible_demo.yml file with

  • tennant id
  • app id (your service principle id)

In your VSCode Terminal

CD into the TF folder

Log in to azure AZ CLI or Powershell

Initialize TF Code

terraform init -upgrade

Plan TF Code

terraform plan -out main.tfplan

Apply TF Code

terraform apply main.tfplan

In your web browser and in ADO Project or Org settings check the agent is showing

image

Ensure your Service Principle has access to the newly created keyvault with permissions to read all secrets

image

In your keyvault add an additional secret

  • password

set the value of your service principle password and click save

Create Library groups

image

image

Click "Link Secrets" from... (if your not using a SP create secure variables here)

image

Fill in the details

image

Click "add", select the serverPassword and click "ok" repeat for password

image

Name the variable group as "Ansible" and click Save

Create a Pipeline

image

Select Azure Repos Git

image

Click your project name

Click Existing Azure Pipelines yaml file

in main branch select the file "/Pipeline/ansible_demo.yml" Click continue

Click Save and run

That should be it and time to take down the environment

DESTROY!!!!!!!!!!!!!

terraform plan -destroy -out main.destroy.tfplan
terraform apply "main.destroy.tfplan"

For further reading and sources that helped this post please see the below

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.