Skip to content

Commit

Permalink
draft: yaml config
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrizionota-ox committed Jan 14, 2025
1 parent 3dace11 commit 2a498df
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pdns_rec_disable_handlers: false

# Configuration directory and files
pdns_rec_config_dir: "{{ default_pdns_rec_config_dir }}"
pdns_rec_config_file: recursor.conf
# pdns_rec_config_file: recursor.conf
pdns_rec_config_lua: "{{ pdns_rec_config_dir }}/config.lua"
pdns_rec_config_lua_file_content: ""
pdns_rec_config_dns_script: "{{ pdns_rec_config_dir }}/dns-script.lua"
Expand All @@ -99,3 +99,7 @@ pdns_rec_config: {}

# Dict with overrides for the service (systemd only)
pdns_rec_service_overrides: "{{ default_pdns_rec_service_overrides }}"

# yaml config file - starting from 5.2 version yaml will be default and legacy is deprecated
pdns_rec_config_yaml_config: "{{ pdns_rec_package_version >= '5.2' }}"
pdns_rec_config_file: "{{ 'recursor.yaml' if pdns_rec_config_yaml_config == True else 'recursor.conf' }}"
13 changes: 12 additions & 1 deletion tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,25 @@
group: "{{ pdns_rec_file_group }}"
mode: "0750"

- name: Generate the PowerDNS Recursor configuration
- name: Generate the PowerDNS Recursor legacy configuration
ansible.builtin.template:
src: recursor.conf.j2
dest: "{{ pdns_rec_config_dir }}/{{ pdns_rec_config_file }}"
owner: "{{ pdns_rec_file_owner }}"
group: "{{ pdns_rec_file_group }}"
mode: "0640"
register: _pdns_recursor_configuration
when: not pdns_rec_config_yaml_config

- name: Generate the PowerDNS Recursor yaml configuration
ansible.builtin.template:
src: recursor.yaml.j2
dest: "{{ pdns_rec_config_dir }}/{{ pdns_rec_config_file }}"
owner: "{{ pdns_rec_file_owner }}"
group: "{{ pdns_rec_file_group }}"
mode: "0640"
register: _pdns_recursor_configuration
when: pdns_rec_config_yaml_config

- name: Ensure that the PowerDNS Recursor 'include-dir' directory exists
ansible.builtin.file:
Expand Down
1 change: 1 addition & 0 deletions templates/recursor.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ pdns_rec_config }}

0 comments on commit 2a498df

Please sign in to comment.