ansible/roles/slapd/tasks/main.yml

48 lines
1.3 KiB
YAML

---
- name: Install slapd
apt: name=slapd
- name: Install slapd-smbk5pwd
apt: name=slapd-smbk5pwd
when: slapd_role == "master"
- name: Remove slapd.d
file: path=/etc/ldap/slapd.d state=absent
notify: Restart slapd
- name: Copy schema definitons
copy: src={{ item }} dest=/etc/ldap/{{ item }}
with_items:
- schema/kitchen.schema
- schema/openssh-lpk.schema
- schema/radius.schema
- schema/samba.schema
notify: Restart slapd
- name: Configure slapd (init script)
copy: src=slapd dest=/etc/default/slapd
notify: Restart slapd
- name: Configure slapd
template: src=slapd.conf.j2 dest=/etc/ldap/slapd.conf
notify: Restart slapd
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/ldap/ssl/srv.key -out /etc/ldap/ssl/srv.crt -days 730 -subj "/CN={{ slapd_hostname }}" creates=/etc/ldap/ssl/srv.crt
notify: Restart slapd
- name: Request nsupdate key for certificate
include_role: name=acme-dnskey-generate
vars:
acme_dnskey_san_domains:
- "{{ slapd_hostname }}"
- "{{ slapd_san }}"
- name: Configure certificate manager for slapd
template: src=certs.j2 dest=/etc/acertmgr/{{ slapd_hostname }}.conf
notify: Run acertmgr
- name: Start slapd
service: name=slapd state=started enabled=yes