How to do it...

Ansible packages cloud modules to interact with Azure resource manager. These modules require Azure Python SDK to interact with the Azure resource manager's APIs. We will now prepare our host to run Ansible using Azure cloud modules and put it together so that it can create and manage Azure resources:

  1. We should start by installing Azure SDK on a host running Ansible:
$ pip install ansible[azure] 
  1. We need to set up credentials for the Azure resource manager to interact with Azure APIs. Azure provides two ways to authenticate with Azure:
    • Active Directory username and password
    • Service principle credentials

We will use service principle credentials to authenticate with the Azure resource manager. We should note that in ...

Get Ansible 2 Cloud Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.