digital_ocean_domain - can it really create DNS records?

I’m new to Ansible and loving it so far. But I’m new so maybe I’m missing something obvious when I can’t figure out how to make the digital_ocean_domain module create DNS records instead of just zone files.

The example here, http://docs.ansible.com/digital_ocean_domain_module.html, creates a DigitalOcean droplet (virtual machine), and then creates a DigitalOcean domain record (DNS zone file) with the IP of the newly created droplet.

What I would really like is to be able to create a DNS A record inside a zone file.

The module code, https://github.com/ansible/ansible/blob/devel/library/cloud/digital_ocean_domain, seems to have some support for records but the documentation doesn’t say how to use it and I’m not sure that it can be used as I’m new to Ansible and my attempts to write YAML that passes in records hasn’t worked.

Does anyone have experience with this module and can you tell me how to use it?

Thanks!

Can you share which line from the example is not working for you, and what parameters you are passing to it?

Also, what version of Ansible are you using?

Sorry for the delay, I didn’t see your response until this morning.

I have my script below which is taken almost verbatim from http://docs.ansible.com/digital_ocean_domain_module.html. The first call to digital_ocean_domain creates a zone file for “example-1.com” with NS records and a default A record “@”. Then it creates a droplet, then it calls digital_ocean_domain again to, hopefully, create a A record for the droplet that was just created and in the existing zone file. What it actually does is create another zone file for “hs2.example-1.com” with NS records and a default A record “@”. So if I create 10 droplets under a domain I would end up with 10 zone files instead of one zone file containing 10 A records as I would expect.

Maybe this was intentional, and I suspect it would work, but it’s not the way I would ever setup DNS. So if it is intentional there should be a big warning in the docs to say so.

Thanks for reading :slight_smile:

It appears as though others have recognized this limitation and have submitted pull requests for a module that would do what you are looking for:

Thanks for the links to the pull requests. I’m looking forward to those being merged.

I forgot to include my version:

ansible --version
ansible 1.7.1