Skip to content

Commit

Permalink
Properly copy generated ddns key to control host
Browse files Browse the repository at this point in the history
Use bind9_keydir for tsigs as well

Closes #74
  • Loading branch information
dirtyhillbilly authored and dirtyhillbilly committed Aug 22, 2023
1 parent 8fd018e commit d00f5c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tasks/create_ddns_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
when: item.update_keyfile is defined

- name: Generate DDNS key
ansible.builtin.shell: "tsig-keygen -a {{ item.update_key_algorithm | d('hmac-sha512') }} {{ item.name }}_{{ item.update_keyfile }}_update > /etc/bind/keys/{{ item.update_keyfile }}.private"
ansible.builtin.shell: "tsig-keygen -a {{ item.update_key_algorithm | d('hmac-sha512') }} {{ item.name }}_{{ item.update_keyfile }}_update > {{ bind9_keydir }}/{{ item.update_keyfile }}.private"
args:
chdir: "{{ bind9_zonedir }}"
register: ddns_key
changed_when: ddns_key.rc != 0
changed_when: ddns_key.rc == 0
when: item.update_keyfile is defined and not update_keyfile_tmp.stat.exists

- name: Copy DDNS key to control host
ansible.builtin.fetch:
src: "/etc/bind/keys/{{ item.update_keyfile }}.private"
src: "{{ bind9_keydir }}/{{ item.update_keyfile }}.private"
dest: "{{ bind9_local_keydir }}/{{ item.update_keyfile }}.private"
mode: "0640"
flat: true
Expand Down

0 comments on commit d00f5c0

Please sign in to comment.