nl2go.cloudflare_dns

Ansible Role: Cloudflare DNS

This Ansible Role helps you manage Cloudflare DNS using the official Ansible module called cloudflare_dns.

What You Need

Role Variables

Here are the variables you can set, with their default values (see defaults/main.yml):

  • cloudflare_dns_account_email: Your Cloudflare account email (e.g., average.joe@example.org).

  • cloudflare_dns_account_api_token: Your Cloudflare account global API token (e.g., 123abc456efg).

  • cloudflare_dns_zone: The default DNS zone (e.g., example.org).

  • cloudflare_dns_records: Use this to set custom DNS records. Example:

    cloudflare_dns_records:
      - name: foo
        value: 127.0.0.1
    
  • To specify a different DNS zone for a record:

    cloudflare_dns_records:
      - name: foo
        value: 127.0.0.1
        zone: example.com
    
  • To delete a DNS record, add state: absent:

    cloudflare_dns_records:
      - name: foo
        value: 127.0.0.1
        state: absent
    
  • Records for the hosts in your inventory will be created automatically:

    cloudflare_dns_host_records:
      - name: "{{ inventory_hostname }}"
        value: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
    
  • All DNS records being managed are combined in this variable:

    cloudflare_dns_all_records: "{{ cloudflare_dns_host_records + cloudflare_dns_records }}"
    

Tags

You can use tags to run specific parts of this role. Available tags:

  • cloudflare_dns, config: For the entire role lifecycle.

Dependencies

There are no dependencies.

Example Playbook

Here is an example playbook:

- hosts: all
  roles:
    - nl2go.cloudflare_dns

Development

To test this role, use docker-molecule or install Molecule locally (note that local installs may lead to version conflicts).

Set your Cloudflare API credentials with environment variables:

export [email protected]
export CLOUDFLARE_DNS_ACCOUNT_API_TOKEN=123abc456efg

Run tests with:

molecule test --all

Maintainers

License

See LICENSE.md for details.

Author Information

This role was created in 2020 by Newsletter2Go GmbH.

Informazioni sul progetto

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

Installa
ansible-galaxy install nl2go.cloudflare_dns
Licenza
mit
Download
5.5k
Proprietario