Use ansible_domain everywhere and bail out if it is empty.
This commit is contained in:
parent
bbcf45bbeb
commit
ed8b7a7fa6
12 changed files with 32 additions and 25 deletions
|
@ -1,5 +1,8 @@
|
|||
## Install and configure nfs-server
|
||||
---
|
||||
- fail: msg="The machine's domain must not be empty."
|
||||
when: ansible_domain | length == 0
|
||||
|
||||
- name: check if there are installing
|
||||
stat: path=/etc/exports
|
||||
register: exports
|
||||
|
@ -40,11 +43,11 @@
|
|||
register: kadmin
|
||||
|
||||
- name: create machine principal
|
||||
command: kadmin.local -q "addprinc -randkey nfs/{{ ansible_hostname }}.{{ ldap_domain }}"
|
||||
command: kadmin.local -q "addprinc -randkey nfs/{{ ansible_hostname }}.{{ ansible_domain }}"
|
||||
when: kadmin.stat.exists and not exports.stat.exists
|
||||
|
||||
- name: add principal to the keytab
|
||||
command: kadmin.local -q "ktadd nfs/{{ ansible_hostname }}.{{ ldap_domain }}"
|
||||
command: kadmin.local -q "ktadd nfs/{{ ansible_hostname }}.{{ ansible_domain }}"
|
||||
notify: "restart rpc-svcgssd"
|
||||
when: kadmin.stat.exists and not exports.stat.exists
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue