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 |
In this tutorial, you learn how to use Bash within Cloud Shell to configure an Azure subscription as your Ansible workspace.
-
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]
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>
To verify the successful configuration, use Ansible to create a resource group.
[!INCLUDE create-resource-group-with-ansible.md]
[!div class="nextstepaction"] Create a basic virtual machine in Azure with Ansible