This commit is contained in:
Hannaeko 2021-07-30 12:36:02 +02:00
parent 5da4fcc1e9
commit 6bee691284
2 changed files with 13 additions and 6 deletions

View file

@ -16,17 +16,24 @@
- name: Generate tsig
become: yes
ansible.builtin.shell: keymgr -t {{ key_name }} > /etc/knot/{{ key_name }}.key
args:
creates: /etc/knot/{{ key_name }}.key
when: "inventory_hostname in groups.primary"
ansible.builtin.shell:
cmd: "keymgr -t {{ key_name }} > /etc/knot/{{ key_name }}.key"
creates: "/etc/knot/{{ key_name }}.key"
run_once: True
- name: Fetch key
become: yes
ansible.builtin.slurp:
src: /etc/knot/{{ key_name }}.key
register: tsig_key
when: "inventory_hostname in groups.primary"
run_once: True
- name: Populate key to all host
set_facts:
tsig_key_content: {{ tsig_key['content'] | b64decode }}
run_once: True
with_items: "{{ play_hosts }}"
delegate_to: "{{ item }}"
- name: Deploy conf
become: yes

View file

@ -7,7 +7,7 @@ log:
- target: syslog
any: info
{{ tsig_key.content | b64decode }}
{{ tsig_key_content }}
remote:
{% for host in groups.all %}