Create Hosted Zone in Route53

287 views
Skip to first unread message

Carlos V

unread,
Dec 9, 2014, 2:30:42 PM12/9/14
to ansible...@googlegroups.com
Is it possible to add a domain to route53 from Ansible?

Looks like it's only possible to add/modify records once you have the zone configured but maybe I'm doing it wrong.


Playbook:

- name: Setup for DNS in AWS
  hosts: 127.0.0.1
  gather_facts: false
  connection: local
  tasks:
    - route53:
        command: create
        zone: "example.com"
        record: "new.example.com"
        type: A
        value: "xxx.xxx.xxx.xxx"
        overwrite: true



Output:

# ansible-playbook -i local 53.yml -vvvv

PLAY [Setup for DNS in AWS] ***************************************************

TASK: [route53 ] **************************************************************
<127.0.0.1> REMOTE_MODULE route53 type=A command=create record=new.example.com value=xxx.xxx.xxx.xxx zone=example.com
<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1418152704.32-223011961135662 && echo $HOME/.ansible/tmp/ansible-tmp-1418152704.32-223011961135662']
<127.0.0.1> PUT /tmp/tmpCH8AVM TO /root/.ansible/tmp/ansible-tmp-1418152704.32-223011961135662/route53
<127.0.0.1> EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1418152704.32-223011961135662/route53; rm -rf /root/.ansible/tmp/ansible-tmp-1418152704.32-223011961135662/ >/dev/null 2>&1']
failed: [127.0.0.1] => {"failed": true}

msg: Zone example.com. does not exist in Route53

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/root/53.retry

127.0.0.1                  : ok=0    changed=0    unreachable=0    failed=1



Toshio Kuratomi

unread,
Dec 9, 2014, 4:40:24 PM12/9/14
to ansible...@googlegroups.com
Yeah, currently the route53 module does not create zones. They have
to already be created. The boto module (which we're using to interact
with route53 and most other amazon services) appears to support
creating zones so so we'd probably take a pull request to implement
that.

-Toshio
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f836430f-7349-4255-95e8-c1144624d99a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Carlos V

unread,
Dec 9, 2014, 7:20:40 PM12/9/14
to ansible...@googlegroups.com
Cool, thanks for the info!
Reply all
Reply to author
Forward
0 new messages