|
@@ -39,13 +39,18 @@
|
|
|
failed_when: false
|
|
|
no_log: true
|
|
|
register: ds389_status_authentication
|
|
|
-
|
|
|
+
|
|
|
+- name: Gathering service facts
|
|
|
+ service_facts:
|
|
|
+
|
|
|
- name: Modify ds389_status
|
|
|
set_fact:
|
|
|
ds389_status: true
|
|
|
when:
|
|
|
- ds389_status_authentication.rc == 0
|
|
|
- ds389_pwpolicy_search_key in ds389_pwpolicy_check.stdout
|
|
|
+ - "'sssd.service' in ansible_facts.services"
|
|
|
+ - sssd_install_search_key in ansible_facts.services['sssd.service'].state
|
|
|
|
|
|
- block:
|
|
|
- name: Install 389-ds
|
|
@@ -53,17 +58,25 @@
|
|
|
name: "{{ ds389_packages }}"
|
|
|
state: present
|
|
|
|
|
|
+ - name: Check ldap instance is running or not
|
|
|
+ command: dsctl {{ ldap_instance }} status
|
|
|
+ changed_when: false
|
|
|
+ failed_when: false
|
|
|
+ register: ldap1_status
|
|
|
+
|
|
|
- name: Create the ldap1.inf file
|
|
|
copy:
|
|
|
src: "{{ role_path }}/files/temp_ldap1.inf"
|
|
|
dest: "{{ ldap1_config_path }}"
|
|
|
- mode: "{{ file_mode }}"
|
|
|
+ mode: "{{ file_mode }}"
|
|
|
+ when: ldap1_search_key in ldap1_status.stdout
|
|
|
|
|
|
- name: Configure ldap1.inf with domain name
|
|
|
lineinfile:
|
|
|
path: "{{ ldap1_config_path }}"
|
|
|
regexp: "^suffix = dc=omnia,dc=test"
|
|
|
line: "suffix = dc={{ domain_name.split('.')[0] }},dc={{ domain_name.split('.')[1] }}"
|
|
|
+ when: ldap1_search_key in ldap1_status.stdout
|
|
|
|
|
|
- name: Configure ldap1.inf with directory manager password
|
|
|
lineinfile:
|
|
@@ -71,12 +84,7 @@
|
|
|
regexp: "^root_password = password"
|
|
|
line: "root_password = {{ ms_directory_manager_password }}"
|
|
|
no_log: true
|
|
|
-
|
|
|
- - name: Check ldap instance is running or not
|
|
|
- command: dsctl {{ ldap_instance }} status
|
|
|
- changed_when: false
|
|
|
- failed_when: false
|
|
|
- register: ldap1_status
|
|
|
+ when: ldap1_search_key in ldap1_status.stdout
|
|
|
|
|
|
- name: Creating 389 directory server instance
|
|
|
shell: dscreate -v from-file {{ ldap1_config_path }} | tee {{ ldap1_output_path }}
|
|
@@ -132,24 +140,28 @@
|
|
|
src: "{{ role_path }}/files/temp_krb5.conf"
|
|
|
dest: "{{ kerberos_conf_path }}"
|
|
|
mode: "{{ file_mode }}"
|
|
|
+ when: not principal_status.stat.exists
|
|
|
|
|
|
- name: Configure kerberos conf file with domain name
|
|
|
replace:
|
|
|
path: "{{ kerberos_conf_path }}"
|
|
|
regexp: "omnia.test"
|
|
|
replace: "{{ domain_name }}"
|
|
|
+ when: not principal_status.stat.exists
|
|
|
|
|
|
- name: Configure kerberos conf file with realm name
|
|
|
replace:
|
|
|
path: "{{ kerberos_conf_path }}"
|
|
|
regexp: "OMNIA.TEST"
|
|
|
replace: "{{ realm_name }}"
|
|
|
+ when: not principal_status.stat.exists
|
|
|
|
|
|
- name: Configure kerberos conf file with hostname
|
|
|
replace:
|
|
|
path: "{{ kerberos_conf_path }}"
|
|
|
regexp: "hostname"
|
|
|
replace: "{{ short_hostname.stdout }}"
|
|
|
+ when: not principal_status.stat.exists
|
|
|
|
|
|
- block:
|
|
|
- name: Setting up the kerberos database
|
|
@@ -191,7 +203,47 @@
|
|
|
shell: set -o pipefail && echo {{ ms_kerberos_admin_password }} | kinit admin
|
|
|
no_log: true
|
|
|
changed_when: false
|
|
|
-
|
|
|
+
|
|
|
+ - name: Install sssd packages
|
|
|
+ zypper:
|
|
|
+ name: "{{ sssd_packages }}"
|
|
|
+ state: present
|
|
|
+
|
|
|
+ - name: Stop and disable nscd
|
|
|
+ systemd:
|
|
|
+ name: nscd
|
|
|
+ state: stopped
|
|
|
+ enabled: no
|
|
|
+ when: "'nscd.service' in ansible_facts.services"
|
|
|
+
|
|
|
+ - name: Check admin group in 389-ds
|
|
|
+ command: dsidm {{ ldap_instance }} group list
|
|
|
+ register: check_admin_group
|
|
|
+ changed_when: false
|
|
|
+
|
|
|
+ - name: Create admin group in 389-ds
|
|
|
+ shell: set -o pipefail && echo {{ admin_group_name }} | dsidm {{ ldap_instance }} group create
|
|
|
+ changed_when: true
|
|
|
+ when: admin_group_name not in check_admin_group.stdout
|
|
|
+
|
|
|
+ - name: Create the sssd.conf file
|
|
|
+ copy:
|
|
|
+ src: "{{ role_path }}/files/temp_sssd.conf"
|
|
|
+ dest: "{{ sssd_config_path }}"
|
|
|
+ mode: "{{ sssd_file_mode }}"
|
|
|
+
|
|
|
+ - name: Configure sssd.conf with domain name
|
|
|
+ replace:
|
|
|
+ path: "{{ sssd_config_path }}"
|
|
|
+ regexp: "dc=omnia,dc=test"
|
|
|
+ replace: "dc={{ domain_name.split('.')[0] }},dc={{ domain_name.split('.')[1] }}"
|
|
|
+
|
|
|
+ - name: Start sssd service
|
|
|
+ systemd:
|
|
|
+ name: sssd
|
|
|
+ state: started
|
|
|
+ enabled: yes
|
|
|
+
|
|
|
- name: Configure password policy in 389-ds
|
|
|
command: dsconf -w {{ ms_directory_manager_password }} -D "cn=Directory Manager" ldap://{{ server_hostname_ms }} pwpolicy set --pwdlockoutduration {{ lockout_duration }} --pwdmaxfailures {{ max_failures }} --pwdresetfailcount {{ failure_reset_interval }}
|
|
|
no_log: true
|