mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Removed unecessary application_id s
This commit is contained in:
37
roles/srv-web-7-7-dns-records/README.md
Normal file
37
roles/srv-web-7-7-dns-records/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Cloudflare DNS Records
|
||||
|
||||
## Description
|
||||
|
||||
This Ansible role automates the management of DNS A-records in Cloudflare zones. It uses the [community.general.cloudflare_dns](https://docs.ansible.com/ansible/latest/collections/community/general/cloudflare_dns_module.html) module to create or update A-records for a list of domains, automatically detects the correct zone for each record, and supports configurable proxy settings.
|
||||
|
||||
## Overview
|
||||
|
||||
Looping over a provided list of domains (`cloudflare_domains`), this role:
|
||||
- Determines the zone name by extracting the last two labels of each domain.
|
||||
- Ensures an A-record for each domain points to the specified IP (`cloudflare_target_ip`).
|
||||
- Honors the `proxied` flag to switch between DNS-only and Cloudflare-proxied modes.
|
||||
- Provides an optional debug task (`enable_debug`) to output the domain list before changes.
|
||||
|
||||
Ideal for environments where bulk or dynamic DNS updates are needed, this role abstracts away the complexity of Cloudflare’s zone and record API.
|
||||
|
||||
## Purpose
|
||||
|
||||
Cloudflare DNS Records delivers an idempotent, scalable solution for managing A-records across multiple Cloudflare zones. Whether you need to onboard hundreds of domains or toggle proxy settings in CI/CD pipelines, this role handles the orchestration and ensures consistency.
|
||||
|
||||
## Features
|
||||
|
||||
- **Automatic Zone Detection:** Parses each domain to derive its zone (`example.com`) without manual intervention.
|
||||
- **Bulk Record Management:** Creates or updates A-records for all entries in `cloudflare_domains`.
|
||||
- **Proxy Toggle:** Configure `proxied: true` or `false` per record to switch between DNS-only and proxied modes.
|
||||
- **Debug Support:** Enable `enable_debug` to print the domain list for validation before execution.
|
||||
- **Flexible Authentication:** Supports both API token (`api_token`) and Global API key + email.
|
||||
- **Low-TTL Option:** Use `ttl: 1` for rapid DNS propagation during dynamic updates.
|
||||
|
||||
## Author
|
||||
|
||||
Kevin Veen-Birkenbach
|
||||
|
||||
## License
|
||||
|
||||
CyMaIS NonCommercial License (CNCL)
|
||||
<https://s.veen.world/cncl>
|
26
roles/srv-web-7-7-dns-records/meta/main.yml
Normal file
26
roles/srv-web-7-7-dns-records/meta/main.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Manages DNS A-records in Cloudflare zones."
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: "All"
|
||||
versions:
|
||||
- "all"
|
||||
galaxy_tags:
|
||||
- "cloudflare"
|
||||
- "dns"
|
||||
- "records"
|
||||
- "ansible"
|
||||
- "network"
|
||||
- "automation"
|
||||
repository: "https://s.veen.world/cymais"
|
||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
dependencies: []
|
13
roles/srv-web-7-7-dns-records/tasks/main.yml
Normal file
13
roles/srv-web-7-7-dns-records/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
- name: Create or update Cloudflare A-record for {{ item }}
|
||||
community.general.cloudflare_dns:
|
||||
api_token: "{{ cloudflare_api_token }}"
|
||||
zone: "{{ item.split('.')[-2:] | join('.') }}"
|
||||
state: present
|
||||
type: A
|
||||
name: "{{ item }}"
|
||||
content: "{{ cloudflare_target_ip }}"
|
||||
ttl: 1
|
||||
proxied: "{{ cloudflare_proxied | int }}"
|
||||
loop: "{{ cloudflare_domains }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
Reference in New Issue
Block a user