Creating an Azure Container Instance (ACI)

Learn how to create an Azure Container Instance (ACI) using Ansible playbook.

It’s time to get to the hands-on goodness! In this chapter project, you will create an Azure Container Instance (ACI) with an Nginx Docker image in Ansible using Azure Cloud Shell.

The Azure Cloud Shell has lots of pre-loaded applications and configuration; one of those is Ansible. Be sure to check out the command-line chapter to learn more about Azure Cloud Shell.

Project overview

To get hands-on with Ansible to create an ACI, you’re going to create an Ansible playbook via the Azure Cloud Shell editor that will run on the Ansible server to create a single ACI using a few variables and a task. Once the playbook is written, you will then run the playbook in Azure Cloud Shell to create the ACI.

Tools to have

To follow along with the project in this chapter, please be sure that you open a PowerShell console via Azure Cloud Shell.

Writing the playbook

To get started, let’s first bring up a code editor. Although you can use any code editor you wish, let’s keep this all in the Azure family by doing everything (even editing) in the Azure Cloud Shell. Assuming that you’re in the Azure Cloud Shell staring at a PowerShell prompt, run code .. This command will bring up the Azure Cloud Shell editor and will open it up to the current directory.

The Azure Cloud Shell editor is a Visual Studio Code lookalike code editor available totally in the Azure Cloud Shell. No external programs are necessary.

Once open, you should see the editor show up above the PowerShell console as shown below.

Get hands-on with 1400+ tech skills courses.