2015-07-16 22:48:46 +02:00
|
|
|
---
|
|
|
|
- name: Create a basic configuration
|
|
|
|
debconf: name=slapd question='{{ item.question }}' value='{{ item.value }}' vtype='{{ item.vtype }}'
|
2016-03-10 16:53:35 +01:00
|
|
|
with_items: '{{ slapd_debconf_params }}'
|
2015-07-16 22:48:46 +02:00
|
|
|
when: openldap_service_enabled
|
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
|
|
|
|
|
|
|
- name: Generate the local admin password
|
|
|
|
shell: slappasswd -h {SSHA} -s {{ slapd_admin_pwd }} > /root/.slapdadmin ; chmod 400 /root/.slapdadmin
|
|
|
|
args:
|
|
|
|
creates: /root/.slapdadmin
|
|
|
|
when: slapd_admin_pwd is defined
|
|
|
|
register: admin_pass_file
|
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
|
|
|
|
|
|
|
- name: Copy the ldif template to set the admin password
|
|
|
|
template: src=adminpwd.ldif.j2 dest=/etc/ldap/adminpwd_ldif.tmpl
|
|
|
|
when: slapd_admin_pwd is defined
|
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
|
|
|
|
|
|
|
- name: Create the ldif file to set the admin password
|
|
|
|
shell: ADMIN_PASS=$( cat /root/.slapdadmin ); sed -e "s/@ADMINPWD@/${ADMIN_PASS}/" /etc/ldap/adminpwd_ldif.tmpl > /etc/ldap/adminpwd.ldif ; chmod 400 /etc/ldap/adminpwd.ldif
|
|
|
|
when: slapd_admin_pwd is defined
|
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
|
|
|
|
|
|
|
- name: Finally set the admin password
|
|
|
|
shell: ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f /etc/ldap/adminpwd.ldif
|
|
|
|
when: ( admin_pass_file | changed )
|
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
|
|
|
|
|
|
|
- name: Install some additional schemas
|
2016-04-15 20:33:23 +02:00
|
|
|
shell: ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/{{ item }} ; touch /etc/ldap/schema/.{{ item }}.installed
|
2015-07-16 22:48:46 +02:00
|
|
|
args:
|
|
|
|
creates: '/etc/ldap/schema/{{ item }}.installed'
|
2016-04-15 20:33:23 +02:00
|
|
|
with_items: '{{ openldap_additional_schemas | default([]) }}'
|
2015-07-16 22:48:46 +02:00
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
|
|
|
|
2016-04-20 15:21:19 +02:00
|
|
|
- name: Install the default environment for slapd
|
|
|
|
template: src=slapd-default.j2 dest=/etc/default/slapd owner=root group=root mode=0644
|
|
|
|
tags: [ 'ldap_server', 'ldap', 'ldap_conf' ]
|
2016-03-10 16:53:35 +01:00
|
|
|
|