keytab: Prefix variable names with keytab_

This commit is contained in:
Timo Makinen 2023-10-14 16:01:08 +00:00
parent 4fb04065f9
commit e2c59bc220
11 changed files with 24 additions and 24 deletions

View file

@ -8,10 +8,10 @@
ansible.builtin.include_role:
name: keytab
vars:
keytab: /etc/dovecot/dovecot.keytab
principals:
keytab_path: /etc/dovecot/dovecot.keytab
keytab_principals:
- "imap/{{ mail_server }}@{{ kerberos_realm }}"
group: dovecot
keytab_group: dovecot
- name: Install privatekey
ansible.builtin.copy:

View file

@ -1,3 +1,3 @@
---
keytab: /etc/krb5.keytab
group: "{{ ansible_wheel }}"
keytab_path: /etc/krb5.keytab
keytab_group: "{{ ansible_wheel }}"

View file

@ -1,7 +1,7 @@
---
- name: Check if keytab exists
ansible.builtin.stat:
path: "{{ keytab }}"
path: "{{ keytab_path }}"
register: keytab_status
check_mode: false
@ -15,7 +15,7 @@
- -k
- "/tmp/{{ inventory_hostname }}.kt"
- "{{ item }}"
with_items: "{{ principals }}"
with_items: "{{ keytab_principals }}"
delegate_to: ldap01.home.foo.sh
when: not keytab_status.stat.exists
@ -39,12 +39,12 @@
ansible.builtin.shell: >-
set -o pipefail &&
umask 077 &&
echo '{{ keytab_data.stdout }}' | base64 -d > "{{ keytab }}"
echo '{{ keytab_data.stdout }}' | base64 -d > "{{ keytab_path }}"
when: not keytab_status.stat.exists
- name: Check keytab permissions
ansible.builtin.file:
path: "{{ keytab }}"
mode: "{% if group == ansible_wheel %}0600{% else %}0640{% endif %}"
path: "{{ keytab_path }}"
mode: "{% if keytab_group == ansible_wheel %}0600{% else %}0640{% endif %}"
owner: root
group: "{{ group }}"
group: "{{ keytab_group }}"