ldap-server: Use FQCN for modules

This commit is contained in:
Timo Makinen 2022-02-24 22:17:58 +00:00
parent 4856562ce9
commit 48f1cf2df0
2 changed files with 25 additions and 25 deletions

View file

@ -1,5 +1,5 @@
---
- name: restart slapd
service:
ansible.builtin.service:
name: slapd
state: restarted

View file

@ -1,6 +1,6 @@
---
- name: install packages
package:
ansible.builtin.package:
name: "{{ item }}"
state: installed
with_items:
@ -9,12 +9,12 @@
- ldapvi
- name: fix selinux context from ldap data diretory
sefcontext:
community.general.sefcontext:
path: "{{ ldap_datadir }}(/.*)?"
setype: slapd_db_t
- name: create ldap data directory
file:
ansible.builtin.file:
path: "{{ ldap_datadir }}"
state: directory
mode: 0700
@ -24,7 +24,7 @@
setype: _default
- name: link ldap data directory
file:
ansible.builtin.file:
path: /srv/ldap
src: /export/ldap
state: link
@ -33,7 +33,7 @@
follow: false
when: ldap_datadir != "/srv/ldap"
- import_role:
- ansible.builtin.import_role:
name: sftpuser
vars:
chroot: /srv/backup
@ -41,7 +41,7 @@
publickeys: "{{ backup_publickeys }}"
- name: create backup directory
file:
ansible.builtin.file:
path: "{{ ldap_backupdir }}"
state: directory
mode: 0750
@ -49,7 +49,7 @@
group: backup
- name: link backup directory
file:
ansible.builtin.file:
path: /srv/backup
src: /export/backup
state: link
@ -59,7 +59,7 @@
when: ldap_backupdir != "/srv/backup"
- name: copy backup script
copy:
ansible.builtin.copy:
dest: /usr/local/sbin/ldap-backup
src: ldap-backup.sh
mode: 0755
@ -67,7 +67,7 @@
group: "{{ ansible_wheel }}"
- name: create backup cron job
cron:
ansible.builtin.cron:
name: ldap-backup
job: /usr/local/sbin/ldap-backup
hour: "0"
@ -75,7 +75,7 @@
user: root
- name: copy spn helper script
copy:
ansible.builtin.copy:
dest: /usr/local/sbin/ldapspn
src: ldapspn.py
mode: 0755
@ -84,7 +84,7 @@
when: ldap_master is defined
- name: remove nss cert databases
file:
ansible.builtin.file:
path: "/etc/openldap/certs/{{ item }}"
state: absent
with_items:
@ -94,7 +94,7 @@
- secmod.db
- name: copy ldap server certificates
copy:
ansible.builtin.copy:
dest: "{{ tls_certs }}/{{ ldap_server_cert }}.crt"
src: "/srv/letsencrypt/live/{{ ldap_server_cert }}/cert.pem"
mode: 0644
@ -103,7 +103,7 @@
tags: certificates
notify: restart slapd
- name: copy ldap server key
copy:
ansible.builtin.copy:
dest: "{{ tls_private }}/{{ ldap_server_cert }}.key"
src: "/srv/letsencrypt/live/{{ ldap_server_cert }}/privkey.pem"
mode: 0640
@ -112,7 +112,7 @@
tags: certificates
notify: restart slapd
- name: copy ldap server certificate chain
copy:
ansible.builtin.copy:
dest: "{{ tls_certs }}/{{ ldap_server_cert }}-chain.crt"
src: "/srv/letsencrypt/live/{{ ldap_server_cert }}/chain.pem"
mode: 0644
@ -121,7 +121,7 @@
tags: certificates
notify: restart slapd
- name: get ldap server chain hash
command:
ansible.builtin.command:
argv:
- openssl
- x509
@ -134,7 +134,7 @@
changed_when: false
tags: certificates
- name: link server chain certificate
file:
ansible.builtin.file:
path: "/etc/openldap/certs/{{ result.stdout }}.0"
src: "{{ tls_certs }}/{{ ldap_server_cert }}-chain.crt"
owner: root
@ -143,7 +143,7 @@
state: link
tags: certificates
- name: link local ca certificate
file:
ansible.builtin.file:
path: "/etc/openldap/certs/{{ pki_cacert_hash }}.0"
src: "{{ tls_certs }}/ca.crt"
owner: root
@ -152,7 +152,7 @@
state: link
- name: create slapd sysconfig file
copy:
ansible.builtin.copy:
dest: /etc/sysconfig/slapd
src: slapd.sysconfig
mode: 0644
@ -161,7 +161,7 @@
notify: restart slapd
- name: add custom schema files
copy:
ansible.builtin.copy:
dest: "/etc/openldap/schema/{{ item }}"
src: "{{ item }}"
mode: 0644
@ -176,7 +176,7 @@
notify: restart slapd
- name: copy check password config
copy:
ansible.builtin.copy:
dest: /etc/openldap/check_password.conf
src: check_password.conf
mode: 0644
@ -184,7 +184,7 @@
group: "{{ ansible_wheel }}"
- name: create slapd main config
template:
ansible.builtin.template:
dest: /etc/openldap/slapd.conf
src: slapd.conf.j2
mode: 0640
@ -193,7 +193,7 @@
notify: restart slapd
- name: add ldap aliases for root
blockinfile:
ansible.builtin.blockinfile:
path: /root/.bash_profile
block: |
# use slapd.conf by default for slap commands
@ -205,13 +205,13 @@
alias ldapvi='ldapvi -h ldapi:/// -Y EXTERNAL'
- name: enable slapd service
service:
ansible.builtin.service:
name: slapd
state: started
enabled: true
- name: copy slapd keytab
copy:
ansible.builtin.copy:
dest: /etc/openldap/slapd.keytab
src: "{{ ansible_private }}/files/keytabs/slapd.keytab"
mode: 0640