You've already forked ansible-role-bind9
fix: add check to verify for newline char in zone files
This commit is contained in:
13
tasks/verify_zone_file.yml
Normal file
13
tasks/verify_zone_file.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: "Read the last character of DNS Zonefile: {{ bind_config_directory + '/' + zone.file }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "tail --bytes 1 {{ bind_config_directory + '/' + zone.file }}"
|
||||
register: _bind9_zone_last_character
|
||||
changed_when: _bind9_zone_last_character.rc == 0
|
||||
failed_when: _bind9_zone_last_character.rc > 0
|
||||
|
||||
- name: "Fail when the last character of DNS zone file is not a newline: {{ bind_config_directory + '/' + zone.file }}"
|
||||
ansible.builtin.fail:
|
||||
msg: "Last character of DNS zone file is not a newline: {{ bind_config_directory + '/' + zone.file }}"
|
||||
failed_when: _bind9_zone_last_character.stdout | regex_search('.+') | default(false)
|
Reference in New Issue
Block a user