This official document Quickstart: Configure Ansible using Azure Cloud Shell
from MS Azure site, asks you to first save the following code as create_rg.yml
, and then run the ansible-playbook
command (shown in second code block below) in Azure Cloud shell.
Question: Where do you save the create_rg.yml
before running the command (shown in second code block below)?
create_rg.yml file:
---
- hosts: localhost
connection: local
tasks:
- name: Creating resource group - "{{ name }}"
azure_rm_resourcegroup:
name: "{{ name }}"
location: "{{ location }}"
register: rg
- debug:
var: rg
ansible-playbook command to run the Azure Cloud Shell:
ansible-playbook create_rg.yml --extra-vars "name=<resource_group_name> location=<resource_group_location>"
Remark: When I save create_rg.yml file in my local folder as C:\TestFolder\create_rg.yml
the above command give the following error:
ERROR! the playbook: C:\TestFolder\create_rg.yml could not be found
You could save the .yml
file into your directory /home/nancy
in the PowerShell or Bash in Azure Cloud Shell instead of your local folder. There is a built-in ansible tool in Azure cloud Shell.