From 889a493fdd1f3b978b6347fc043c5479260921c6 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 8 Nov 2020 00:22:08 +0000 Subject: [PATCH] Implement has_debug_instance and use to lower ttl --- group_vars/all/vars.yml | 4 +++- roles/dns/entries/defaults/main.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 30cd7fa..13a6cac 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -31,7 +31,8 @@ backup_mysql_database_scripts_directory: "{{ backup_scripts_directory }}/mysql_d # If debug mode is disabled, the compatibility to the "debug domain" will be lost and the original's instance DNS config will be overwritten # Other variables will need to be adjusted if both instances run on the same server is_debug_instance: no -delete_debug_dns_entries: "{{ not is_debug_instance }}" +has_debug_instance: "{{ is_debug_instance }}" +delete_debug_dns_entries: "{{ not has_debug_instance }}" debug_domain: "debug-instance.{{ domain }}" # used if is_debug_instance / on "debug mode", should only prefix domain effective_domain: "{{ is_debug_instance | ternary(debug_domain, domain) }}" @@ -52,6 +53,7 @@ global_dns_session_key_path: "/var/run/named/session.key" global_dns_session_key_algorithm: "hmac-sha512" global_dns_update_key_algorithm: "ED25519" global_dns_ttl: "{{ 60 * 60 }}" # default if omitted in all cases +global_dns_debug_ttl: "{{ 60 }}" # mostly used if has_debug_instance to allow short transfer times global_ssh_key_directory: "{{ global_public_key_directory }}/ssh" global_ssh_host_key_directory: "{{ global_ssh_key_directory }}/hosts" diff --git a/roles/dns/entries/defaults/main.yml b/roles/dns/entries/defaults/main.yml index 3228943..2e94efc 100644 --- a/roles/dns/entries/defaults/main.yml +++ b/roles/dns/entries/defaults/main.yml @@ -7,6 +7,6 @@ dns_zone_domain: "{{ lookup('pipe', global_public_key_directory|quote + '/dns_zone.py ' + domain|quote) }}" # domain of dns zone dns_system_domain: "{{ lookup('file', global_dns_list_directory + '/' + dns_zone_domain) }}" # domain of dns authority server -ttl_default: "{{ global_dns_ttl }}" # TTL for all entries where none was given +ttl_default: "{{ has_debug_instance | ternary(global_dns_debug_ttl, global_dns_ttl) }}" # TTL for all entries where none was given # entries (example: [{domain: "example.com.", ttl: 86400, class: "IN", type: "A", data: "0.0.0.0"},"example.com. IN AAAA ::",…], type/data or raw required, class will be ignored)