ansible-collection-famedly-.../roles/ldap/tasks/main.yml

58 lines
1.7 KiB
YAML

---
- name: "Ensure base path exists"
file:
path: "{{ ldap_base_path }}"
state: "directory"
mode: "0755"
tags: ["prepare", "prepare-ldap"]
- name: "Create volume paths"
file:
path: "{{ item }}"
state: "directory"
mode: "0755"
loop:
- "{{ ldap_data_path }}"
- "{{ ldap_config_path }}"
- "{{ ldap_base_path }}/sock"
tags: ["prepare", "prepare-ldap"]
- name: "Provide intial container configuration"
import_tasks: "initialize.yml"
- name: "Ensure LDAP container image is pulled"
community.docker.docker_image:
name: "{{ ldap_container_image_reference }}"
force_source: "{{ ldap_container_pull }}"
source: "pull"
state: "present"
tags: ["prepare", "prepare-ldap"]
- name: "Ensure LDAP container is started"
community.docker.docker_container:
name: "{{ ldap_container_name }}"
image: "{{ ldap_container_image_reference }}"
ports: "{{ ldap_container_ports }}"
volumes: "{{ ldap_container_volumes }}"
labels: "{{ ldap_container_labels_complete }}"
networks: "{{ ldap_container_networks }}"
etc_hosts: "{{ ldap_container_etc_hosts }}"
ulimits: "{{ ldap_container_ulimits }}"
memory_reservation: "{{ ldap_container_memory_reservation }}"
memory: "{{ ldap_container_memory }}"
recreate: "{{ ldap_container_recreate }}"
restart_policy: "unless-stopped"
command: "{{ ldap_container_command | default(omit) }}"
state: "started"
healthcheck:
test: >-
[[ $(netstat -plnte | grep slapd | wc -l) -ge 1 ]]
&& [[ $(ps aux | grep slapd | wc -l) -ge 1 ]]
|| exit 1
tags: ["deploy", "deploy-ldap"]
- name: "Configure LDAP DIT"
import_tasks: "configure.yml"
- name: "Set up phpLDAPAdmin container"
import_tasks: "ldap-web-ui.yml"