Why not just use the `uri` module?

The following should be equivalent:

- uri:
    method: PATCH
    url: "http://{{ pilot_pdns }}:8081/api/v1/servers/localhost/zones/{{
pilot_dom }}"
    body:
      rrsets:
        - name: "{{ arecord }}"
          type: A
          ttl: 86400
          changetype: REPLACE
          records:
            - content: "{{ iprecord }}"
              disabled: false
    body_format: json
    headers:
      'X-API-Key': changeme
    return_content: yes
  register: whatever
  tags:
    - add_pdns
  vars:
    pilot_dns: "{{ input_dns }}"
    pilot_dom: "{{ input_domain }}"
    arecord: "{{ input_hostname }}"
    iprecord: "{{ input_ip }}"

On Tue, Apr 11, 2017 at 7:18 PM, Shankar Bala <[email protected]>
wrote:

> Hi All
>
> I am trying to run ansible playbook to create powerdns record .pdns.yml
>
> - name: add dns record
>     vars:
>       pilot_dns: "{{ input_dns }}"
>       pilot_dom: "{{ input_domain }}"
>       arecord: "{{ input_hostname }}"
>       iprecord: "{{ input_ip }}"
>     command: curl -X PATCH --data '{"rrsets": [ {"name": "'" {{ arecord }}
> ".'", "type": "A", "ttl": 86400, "changetype": "REPLACE", "records": [
> {"content": "'" {{ iprecord }} "'", "disabled": false } ] } ] }' -H
> "'X-API-Key: changeme'" 'http://"{{ pilot_pdns 
> }}":8081/api/v1/servers/localhost/zones/"{{
> pilot_dom }}".' | jq .
>     tags: add_pdns
>
> I get syntax error when i run as "ansible-playbook pdns.yml --check"
>
> ERROR! Syntax Error while loading YAML.
>    The offending line appears to be:
>
>       iprecord: "{{ input_ip }}"
>     command: curl -X PATCH --data '{"rrsets": [ {"name": "'" {{ arecord }}
> ".'", "type": "A", "ttl": 86400, "changetype": "REPLACE", "records": [
> {"content": "'" {{ iprecord }} "'", "disabled": false } ] } ] }' -H
> "'X-API-Key: changeme'" 'http://"{{ pilot_pdns 
> }}":8081/api/v1/servers/localhost/zones/"{{
> pilot_dom }}".' | jq .
>                                             ^ here
>
> any help here ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/7f33367e-f6a5-44c7-8f5b-2374f481522f%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/7f33367e-f6a5-44c7-8f5b-2374f481522f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v878ubgT1zDhZSW-HaKYgzCn3nsao%3Dv0q8HJgYwmVFJ3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to