cloudflare_dns

Travis (.org) branch Ansible Galaxy GitHub tag (latest by date) Ansible Galaxy Downloads

Ansible Role: Cloudflare DNS

An Ansible Role that manages Cloudflare DNS. Based on the cloudflare_dns, the official Ansible module.

Prerequisites

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

cloudflare_dns_account_email: [email protected]

Cloudflare account email.

cloudflare_dns_account_api_token: 123abc456efg

Cloudflare account global API token.

cloudflare_dns_zone: example.org

Default target DNS zone.

cloudflare_dns_records:
  - name: foo
    value: 127.0.0.1

Use cloudflare_dns_records to specify custom DNS records.

cloudflare_dns_records:
  - name: foo
    value: 127.0.0.1
    zone: example.com

Use zone to override the DNS zone for a particular DNS entry.

cloudflare_dns_records:
  - name: foo
    value: 127.0.0.1
    state: absent

Add state: absent to ensure a DNS record is removed.

cloudflare_dns_host_records:
  - name: "{{ inventory_hostname }}"
    value: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"

DNS records for the inventory hosts are created automatically based on the template above.

cloudflare_dns_all_records: "{{ cloudflare_dns_host_records + cloudflare_dns_records }}"

All managed DNS records are combined within the cloudflare_dns_all_records variable.

Tags

Tags can be used to limit the role execution to a particular task module. Following tags are available:

  • cloudflare_dns,config: Covers the full role lifecycle.

Dependencies

None.

Example Playbook

- hosts: all
  roles:
     - nl2go.cloudflare_dns
          

Development

Use docker-molecule following the instructions to run Molecule or install Molecule locally (not recommended, version conflicts might appear).

Provide Cloudflare API credentials using environment variables:

export [email protected]
export CLOUDFLARE_DNS_ACCOUNT_API_TOKEN=123abc456efg

Use following to run tests:

molecule test --all
   

Maintainers

License

See the LICENSE.md file for details.

Author Information

This role was created by in 2020 by Newsletter2Go GmbH.

About

Manage Cloudflare DNS (https://api.cloudflare.com) using Ansible.

Install
ansible-galaxy install nl2go/ansible-role-cloudflare-dns
GitHub repository
License
mit
Downloads
5514