- name: configure OpenLDAP (domain)
|
|
debconf:
|
|
name: 'slapd'
|
|
question: 'slapd/domain'
|
|
vtype: 'string'
|
|
value: '{{ ldap_domain }}'
|
|
- name: configure OpenLDAP (configure)
|
|
debconf:
|
|
name: 'slapd'
|
|
question: 'slapd/dump_database'
|
|
vtype: 'string'
|
|
value: 'when needed'
|
|
- name: configure OpenLDAP (organization)
|
|
debconf:
|
|
name: 'slapd'
|
|
question: 'shared/organization'
|
|
vtype: 'string'
|
|
value: '{{ ldap_organization }}'
|
|
- name: generate admin password
|
|
gen_passwd: length=20
|
|
register: new_passwd
|
|
- name: configure OpenLDAP (password1)
|
|
debconf:
|
|
name: 'slapd'
|
|
question: 'slapd/password1'
|
|
vtype: 'string'
|
|
value: '{{ new_passwd.passwd }}'
|
|
- name: configure OpenLDAP (password2)
|
|
debconf:
|
|
name: 'slapd'
|
|
question: 'slapd/password2'
|
|
vtype: 'string'
|
|
value: '{{ new_passwd.passwd }}'
|
|
- name: configure phamm-ldap
|
|
debconf:
|
|
name: 'phamm-ldap'
|
|
question: 'phamm-ldap/init_base_ldap'
|
|
vtype: 'boolean'
|
|
value: false
|
|
- name: install ldap packages
|
|
apt:
|
|
name: '{{ item }}'
|
|
state: latest
|
|
install_recommends: false
|
|
with_items:
|
|
- slapd
|
|
- ldap-utils
|
|
- phamm-ldap
|
|
- sudo
|
|
- name: upload slapd config
|
|
template:
|
|
src: slapd.conf.j2
|
|
dest: "/etc/ldap/slapd.conf"
|
|
- name: update slapd config
|
|
shell: slaptest -f /etc/ldap/slapd.conf -F /etc/ldap/slapd.d
|
|
args:
|
|
creates: "/etc/ldap/slapd.d/cn=config/cn=schema/cn={4}phamm.ldif"
|
|
become: true
|
|
become_method: sudo
|
|
become_user: openldap
|
|
- name: enable OpenLDAP server
|
|
service:
|
|
name: 'slapd'
|
|
enabled: true
|
|
state: started
|