- include_role:
|
|
name: service
|
|
vars:
|
|
service_name: nscd
|
|
service_packages: nscd
|
|
|
|
- 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
|
|
- include_role:
|
|
name: service
|
|
vars:
|
|
service_name: slapd
|
|
service_packages:
|
|
- 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
|
|
notify: restart slapd
|
|
|
|
- name: fix missing memberOf module load
|
|
lineinfile:
|
|
dest: /etc/ldap/slapd.d/cn=config/cn=module{0}.ldif
|
|
line: "olcModuleLoad: {1}memberof"
|
|
notify: restart slapd
|
|
- name: upload default tree
|
|
template:
|
|
dest=/etc/ldap/default_tree.ldif
|
|
src=default_tree.ldif.j2
|
|
owner=root
|
|
group=root
|
|
mode=0400
|
|
register: upload_default_tree
|
|
- name: create default tree
|
|
shell: slapadd -l /etc/ldap/default_tree.ldif
|
|
when: upload_default_tree.changed
|
|
notify: restart slapd
|
|
- name: enable OpenLDAP server
|
|
service:
|
|
name: 'slapd'
|
|
enabled: true
|
|
state: started
|