ansible – ERROR! We were unable to read either as JSON nor YAML [closed]

If it is not a copy+paste issue, I think the indentation on your tasks is not valid. In Ansible tasks: is a YAML list. So the list items should be indented appropriately.

Something like this:

---
- 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 }}"

Update

Just noticed the examples on the link referenced in your question. Those examples depict a different syntax (indentation), from the examples on Ansible module documentation for azure_rm_publicipaddress_module.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top