Learning DevOps
上QQ阅读APP看书,第一时间看更新

Integrating Ansible into Azure Cloud Shell

If we have an Azure subscription, we learned in Chapter 2Provisioning Cloud Infrastructure with Terraform, that Azure Cloud Shell integrates third-party tools that can be used in Azure without having to install them on a VM. Among these tools is Terraform, which we saw in detail in the previous chapter, but there is also Ansible, which Microsoft has integrated to facilitate the automatic configuration of the VMs that are hosted in Azure.

To use Ansible in Azure Cloud, we must do the following:

  1. Connect to the Azure portal at https://portal.azure.com.
  2. Open Cloud Shell.
  3. Choose Bash mode.
  4. In the Terminal that opens, we now have access to all Ansible commands.

The following screenshot shows the Ansible command in Azure Cloud Shell:

This way, it will be possible to use Ansible for development and testing without installing any software.

Also, Ansible has modules that allow the provisioning of an Azure infrastructure (such as Terraform, but this aspect of Ansible will not be covered in this book), and therefore its integration into Azure Cloud Shell allows a simplified authentication.

Detailed documentation on integrating Ansible into Azure Cloud Shell is available here:  https://docs.microsoft.com/en-us/azure/ansible/ansible-run-playbook-in-cloudshell.

Before we start using Ansible, we will review the important concepts (or artifacts) of Ansible, which will serve us throughout this chapter.