Skip to content

Files

47 lines (32 loc) · 2 KB

ansible-run-playbook-in-cloudshell.md

File metadata and controls

47 lines (32 loc) · 2 KB
title description ms.service keywords author manager ms.author ms.date ms.topic
Run Ansible with Bash in Azure Cloud Shell
Learn how to perform various Ansible tasks with Bash in Azure Cloud Shell
ansible
ansible, azure, devops, bash, cloudshell, playbook, bash
tomarcher
jeconnoc
tarcher
08/07/2018
article

Run Ansible with Bash in Azure Cloud Shell

In this tutorial, you learn how to use Bash within Cloud Shell to configure an Azure subscription as your Ansible workspace.

Prerequisites

  • Azure subscription - If you don't have an Azure subscription, create a free account.

  • Configure Azure Cloud Shell - If you are new to Azure Cloud Shell, the article, Quickstart for Bash in Azure Cloud Shell, illustrates how to start and configure Cloud Shell.

[!INCLUDE cloud-shell-try-it.md]

Automatic credential configuration

When signed into the Cloud Shell, Ansible authenticates with Azure to manage infrastructure without any additional configuration. If you have more than one subscription, you can choose which subscription Ansible should work with by exporting the AZURE_SUBSCRIPTION_ID environment variable. To list all of your Azure subscriptions, run the following command:

az account list

Using the id of the subscription with which you want to work, set the AZURE_SUBSCRIPTION_ID as follows:

export AZURE_SUBSCRIPTION_ID=<your-subscription-id>

Verify the configuration

To verify the successful configuration, use Ansible to create a resource group.

[!INCLUDE create-resource-group-with-ansible.md]

Next steps

[!div class="nextstepaction"] Create a basic virtual machine in Azure with Ansible