This self-paced course will help you prepare for the Azure Developer certification exam AZ-204: Developing Solutions for Microsoft Azure.

Azure DevOps CICD with Ansible Infra Automation blog will help you understand how to use Ansible to create an Azure DevOps CICD pipeline. Ansible is an open-source tool that automates cloud provisioning, configuration management, and application deployments. Using Ansible you can provision virtual machines, containers, networks, and complete cloud infrastructures. In addition, Ansible allows you to automate the deployment and configuration of resources in your environment.
Ansible includes a suite of Ansible modules that can be executed directly on remote hosts or via playbooks.
Users can also create their own modules. Modules can be used to control system resources — such as services, packages, or files — or execute system commands.
Things we are going to achieve in this lab scenarios are given below :
3. Once after we import , we will be able to see the Azure DevOps project imported like below.
4. When we go to the Repositories , we will be able to see the code that we have imported to create a Website automation using ansible.
az ad sp create-for-rbac — name AnsibleDemo
3. Once after the service principal is created , we can now create a VM for the ansible server .
4. Click Connect and copy the login command under the SSH tab.
5. Now we must create a directory named .azure in the home directory and a credentials file under it. Type the following commands to create them.
mkdir ~/.azure
vi ~/.azure/credentials
6. Now, we need ssh authentication using Ansible Control Machine private/public key pair. Now let us create a pair of private and public keys. Run the following command to generate a private/public key pair for ssh and to install the public key in the local machine.
ssh-keygen -t rsa
chmod 755 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
ssh-copy-id [email protected]
7. We need SSH private key to created SSH endpoint in Azure DevOps service. Run the following command to get the private key. Copy the private key to notepad.
cat ~/.ssh/id_rsa
2. Next , we need to go to the repos and then change the ansible yaml file to give the details of the Azure resources.
After making these changes, try to commit the file and then start the CI pipeline .
3. Navigate to Pipeline » Releases. Select Ansible-CD and click Edit pipeline.
4. Under the Inventory section, select Host list as inventory location and enter pubic ip of your ansible vm in Host list field as shown below.
5. Select the Azure App Service Deploy task. Select the Azure subscription from the drop-down list and click Authorize to configure Azure service connection. And this application requires few app settings to connect to the MySQL database provisioned using Ansible script. That we are updating using the App settings parameter in the task.
Once the release is success navigate to your Azure portal. Search for smh360web in App services. Select the app that created with smh360-xxxx and browse to view the application deployed.
We can Login to the site with the following credentials.
Username: [email protected]
Password: 1234
This self-paced course will help you prepare for the Azure Developer certification exam AZ-204: Developing Solutions for Microsoft Azure.