kerberos5: Small refactore

This commit is contained in:
Андрей Лимачко 2022-04-11 22:46:10 +04:00
parent 54c4fe6021
commit 623e2ba9c2
2 changed files with 11 additions and 3 deletions

View File

@ -15,6 +15,7 @@
register: register:
altlinux_openresolv_status altlinux_openresolv_status
failed_when: False failed_when: False
changed_when: False
- set_fact: - set_fact:
altlinux_openresolv_exists: "{{ altlinux_openresolv_status.rc != 3 }}" altlinux_openresolv_exists: "{{ altlinux_openresolv_status.rc != 3 }}"
@ -36,9 +37,10 @@
group: root group: root
mode: 0644 mode: 0644
- name: set hostname (non permanent) - name: set hostname
shell: hostname "{{inventory_hostname_short}}.{{krb5_realm}}" ansible.builtin.hostname:
changed_when: false name: "{{ inventory_hostname_short }}.{{ krb5_realm }}"
use: systemd
- name: Deploy Kerberos 5 server - name: Deploy Kerberos 5 server
include_tasks: master.yml include_tasks: master.yml

View File

@ -52,10 +52,16 @@
group: root group: root
mode: 0600 mode: 0600
- name: Check Kerberos 5 admin principal
shell: "kadmin.local listprincs admin/admin"
register: admin_principal_state
changed_when: False
# Then we need at least one principal with administrative privileges # Then we need at least one principal with administrative privileges
# in order to work with Kerberos database via `kadmin` daemon. # in order to work with Kerberos database via `kadmin` daemon.
- name: Create Kerberos 5 admin principal - name: Create Kerberos 5 admin principal
shell: "kadmin.local -q 'addprinc -pw {{ krb5_admin_pass }} admin/admin@{{ krb5_realm | upper }}'" shell: "kadmin.local -q 'addprinc -pw {{ krb5_admin_pass }} admin/admin@{{ krb5_realm | upper }}'"
when: admin_principal_state is success and admin_principal_state.stdout | length == 0
# Start krb5kdc finally # Start krb5kdc finally
- name: Enable and start krb5kdc - name: Enable and start krb5kdc