# Create Hosted Zone in Route53

**URL:** <https://forum.ansible.com/t/create-hosted-zone-in-route53/17002>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 9, 2014, 7:30pm UTC](https://forum.ansible.com/t/create-hosted-zone-in-route53/17002 "2014-12-09T19:30:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos\_V](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@Carlos\_V](https://forum.ansible.com/u/Carlos_V)\
**Post date:** [December 9, 2014, 7:30pm UTC](https://forum.ansible.com/t/create-hosted-zone-in-route53/17002/1 "2014-12-09T19:30:42Z")

</div>

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](http://example.com)”  
record: “[new.example.com](http://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](http://record=new.example.com) value=xxx.xxx.xxx.xxx [zone=example.com](http://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](http://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

`

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [December 9, 2014, 9:40pm UTC](https://forum.ansible.com/t/create-hosted-zone-in-route53/17002/2 "2014-12-09T21:40:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Carlos\_V](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@Carlos\_V](https://forum.ansible.com/u/Carlos_V)\
**Post date:** [December 10, 2014, 12:20am UTC](https://forum.ansible.com/t/create-hosted-zone-in-route53/17002/3 "2014-12-10T00:20:40Z")

</div>

Cool, thanks for the info!
