In Step 3 - Create a Public IP
of this tutorial Deploy a Windows VM to Azure with Ansible, I am getting the error shown below when I run the following YAML playbook
in Azure Cloud Shell
. Question: What I may be missing here that's causing this error, and how it can be corrected? I saw similar issue online here but it did not help since I'm not making the mistake mentioned in that online post.
create_public_ip.yaml:
---
- hosts: localhost
tasks:
- name: Create public IP address
azure_rm_publicipaddress:
resource_group: rg-cs-ansible
allocation_method: Static
name: pip-cs-web
register: output_ip_address
- name: Output public IP
debug:
msg: "The public IP is {{ output_ip_address.state.ip_address }}"
Error:
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: No JSON object could be decoded
Syntax Error while loading YAML.
mapping values are not allowed here
The error appears to be in '/home/myAcctName/clouddrive/MyDir/create_public_ip.yaml': line 5, column 29, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Create public IP address
azure_rm_publicipaddress:
^ here
---
at the top of the file had gone missing. Syntax error. – Dressmaker