Using Azure DevOps with Ansible - azure-devops

I want to deploy an Ansible playbook through Azure DevOps but the Ansible extension requires us to have a Linux VM configured with Ansible in order to deploy our playbook. Is there a way to deploy the Ansible playbook through Azure DevOps withougt needing to configure a Linux VM first?

To run this Ansible extension, Linux VM just be one of choice. If you don't want use VM, you can choose another method: Private Linux agent.
Just install a private linux agent in your Linux machine.
Then during the pipeline configuration, select Agent machine.
This method do not need you create a linux VM and create SSH endpoint with that VM. Just install linux agent into machine, then the pipeline can run with that.
Note:
Do not forget the prerequisites: The Playbook and Inventory files be located on a private Linux agent.

Related

VSTS Agent Check if VM Already in Release Environment

I'm trying to use Powershell DSC to provision virtual machines in Azure and use Azure DevOps to manage the actually code deployment onto the virtual machines. The DSC script is setup to install IIS, asp.net core hosting, setup the sites in IIS, but not actually deploy any application code. The last step in the DSC is to add the virtual machine to azure devops. I went into the Environments tab in devops and copied the powershell script provided, parameterized my PAT so it could be passed into the configuration script, and executed. However, when the script runs a second time, it gives an error because the a resource already exists with the same name in that environment. I could not find a way to check if the VM was already registered as an environment resource in devops using the vsts agent config. I'm considering using the --replace flag, but I don't know if that will lose my deployment history or has any other consequences.
Is there a way to check if a Virtual Machine is already registered as a resource in an Azure DevOps environment.

Automate PostgreSQL scripts from azure devops without installing any client tools/drivers on my local machine

My requirement is - Automate the PostgreSQL scripts from azure devops without installing any client tools/drivers on my local machine. We have couple of .sql, .fct and .prc files in repository. Pipeline should pickup these files and connect azure Postgres server and run the scripts.
PostgreSQL is integrated in the Microsoft hosted agent, you can consider using the hosted agent to run the pipeline.
About the software installed on the hosted agent,please refer to this document.

Creating release pipeline to several VMs

I have multiple ASP.NET web applications which I want to release into different VMs. Manually installing a DevOps agent in every single VM seems really inefficient. Is there a way to make this process faster? Is it possible to create release pipeline that could directly push the code to the public ip of the VM?
As workaround, you can prepare scripts to register each new agent. Here you can find parameters: Self-hosted Windows agents - Unattended config.
If you deploy your web application with IIS deployment task,
You can have a try using task Manage IIS, which can create website in a remote machine.
And then you can add a Windows machine file copy task to copy the build artifacts to the website Physical path in the remote machine.
Another workaround is that you can manage IIS with powershell script. So that you can add task PowerShell on target machines to run powershell script to manage IIS website. You can refer the example scripts at this page, and this page. For more information about IIS powrshell command you can refer here

how to deploy an application to a particular ubuntu server using azure-devops?

I have my code in the azure repos.I have created the release pipeline which runs the task "npm install" and "npm run start".This will deploy my application.But I want to deploy this application to my ubuntu server 206.189.22.155 from the azure release pipeline.Is there any way I can configure the release pipeline to use my ubuntu server?
The only agent pool available for me is "Azure Pipelines" and for agent specification I used "ubuntu-16.04".Iam totally confused about how this works.
I just want my application to run on http://206.189.22.155:5000. I can run the application directly in the server, but the whole point is to run it from the release pipeline.So how do I connect the pipeline to my ubuntu server?I think my default azure uses some kind of virtual machine for deployment.
You can create a deployment group in Azure DevOps. Deployment groups in Azure pipelines make it easier to organize the servers you want to use to host your app. In Azure pipelines -> Devployment group, select “+New” button and type of target to register. Copy and run the Registration script in your Ubuntu server.
You can refer to https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-linuxvm-deploygroups?view=azure-devops&tabs=java-script#define-your-ci-build-pipeline and https://learn.microsoft.com/en-us/azure/devops/pipelines/release/deployment-groups/index?view=azure-devops for more detailed information
After you create the deployment group, you can choose it in your release pipeline
And after you configure you deployment group, you can deploy your app to the specific server.

Azure Devops hosted Ubuntu agent cancels build with edited hosts file

If I edit the hosts file using the Ubuntu agent the build just cancels all together. Had no such issue with Host Linux agent. Any ideas?
Have tried using npm package hostile to edit the hosts file, and through terminal using sudo tee.