2022-06-29 23:55:22 +02:00
|
|
|
---
|
|
|
|
- hosts: krypton.n39.eu
|
|
|
|
become: true
|
|
|
|
|
|
|
|
vars:
|
|
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
|
|
|
|
|
|
data_dir: "/srv/data"
|
|
|
|
|
2022-07-05 20:52:03 +02:00
|
|
|
docker_ip_ranges: ["172.16.0.0/12", "192.168.0.0/16"]
|
|
|
|
|
2022-07-05 20:37:07 +02:00
|
|
|
openldap_data: "{{ data_dir }}/openldap"
|
|
|
|
openldap_domain: "ldap.n39.eu"
|
2022-07-05 20:52:03 +02:00
|
|
|
ldap_domain: "netz39.de"
|
2022-07-05 20:37:07 +02:00
|
|
|
ldap_org: "Netz39 e.V."
|
2022-07-05 20:52:03 +02:00
|
|
|
ldap_base_dn: "dc=netz39,dc=de"
|
2022-07-05 20:37:07 +02:00
|
|
|
|
2022-09-06 20:31:27 +02:00
|
|
|
entities_validation_svc_host_port: 9001
|
|
|
|
|
|
|
|
|
2022-06-29 23:55:22 +02:00
|
|
|
roles:
|
2022-12-12 18:53:03 +01:00
|
|
|
# role 'docker_setup' applied through group 'docker_host'
|
2022-09-06 20:13:40 +02:00
|
|
|
- role: apache
|
2022-10-23 22:49:57 +02:00
|
|
|
- role: apache_letsencrypt # Uses configuration from dehydrated setup
|
2022-09-06 20:13:40 +02:00
|
|
|
- role: ansible-role-dehydrated
|
|
|
|
vars:
|
|
|
|
dehydrated_contact_email: "{{ server_admin }}"
|
|
|
|
dehydrated_domains:
|
2022-11-18 08:42:06 +01:00
|
|
|
- name: entities-validation.svc.n39.eu
|
2022-09-06 20:13:40 +02:00
|
|
|
- role: penguineer.dehydrated_cron
|
2022-06-29 23:55:22 +02:00
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
2022-07-05 20:37:07 +02:00
|
|
|
# - name: Setup dehydrated challenge endpoint for {{ openldap_domain }}
|
|
|
|
# include_role:
|
|
|
|
# name: setup-http-dehydrated
|
|
|
|
# vars:
|
|
|
|
# site_name: "{{ openldap_domain }}"
|
|
|
|
|
|
|
|
- name: Ensure openLDAP directories are present.
|
|
|
|
file:
|
2022-10-26 21:55:30 +02:00
|
|
|
path: "{{ item.path }}"
|
|
|
|
mode: "0755"
|
2022-07-05 20:37:07 +02:00
|
|
|
state: directory
|
|
|
|
with_items:
|
2022-10-26 21:55:30 +02:00
|
|
|
- path: "{{ openldap_data }}/ldap"
|
|
|
|
- path: "{{ openldap_data }}/slapd"
|
|
|
|
- path: "{{ openldap_data }}/ldif"
|
|
|
|
- path: "{{ dehydrated_certs_dir }}/{{ openldap_domain }}"
|
2022-07-05 20:37:07 +02:00
|
|
|
|
|
|
|
- name: Ensure container for openLDAP is running.
|
|
|
|
docker_container:
|
|
|
|
name: openLDAP
|
2023-07-28 21:52:44 +02:00
|
|
|
image: osixia/openldap:1.5.0
|
2022-07-05 20:37:07 +02:00
|
|
|
detach: yes
|
|
|
|
state: started
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
container_default_behavior: no_defaults
|
|
|
|
pull: true
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-07-05 20:37:07 +02:00
|
|
|
LDAP_LOG_LEVEL: "256"
|
2022-10-23 22:21:56 +02:00
|
|
|
LDAP_ORGANISATION: "{{ ldap_org }}"
|
|
|
|
LDAP_DOMAIN: "{{ ldap_domain }}"
|
|
|
|
LDAP_BASE_DN: "{{ ldap_base_dn }}"
|
2022-07-05 20:37:07 +02:00
|
|
|
LDAP_READONLY_USER: "false"
|
|
|
|
|
2022-10-23 22:21:56 +02:00
|
|
|
LDAP_ADMIN_PASSWORD: "{{ ldap_admin_password }}"
|
|
|
|
# LDAP_CONFIG_PASSWORD: "{{ ldap_config_password }}"
|
2022-07-05 20:37:07 +02:00
|
|
|
|
|
|
|
LDAP_RFC2307BIS_SCHEMA: "true"
|
|
|
|
|
|
|
|
LDAP_TLS_CIPHER_SUITE: "SECURE256:-VERS-SSL3.0"
|
|
|
|
|
2022-07-05 20:52:03 +02:00
|
|
|
LDAP_REPLICATION: "no"
|
2022-07-05 20:37:07 +02:00
|
|
|
|
|
|
|
KEEP_EXISTING_CONFIG: "false"
|
|
|
|
LDAP_REMOVE_CONFIG_AFTER_SETUP: "true"
|
|
|
|
published_ports:
|
2022-10-26 18:56:20 +02:00
|
|
|
- "389:389" # unencrypted/STARTTLS
|
|
|
|
- "636:636" # SSL
|
2022-07-05 20:37:07 +02:00
|
|
|
volumes:
|
|
|
|
- "{{ openldap_data }}/ldap:/var/lib/ldap"
|
|
|
|
- "{{ openldap_data }}/slapd:/etc/ldap/slapd.d"
|
2022-10-24 21:14:40 +02:00
|
|
|
- "{{ dehydrated_certs_dir }}/{{ openldap_domain }}:/container/service/slapd/assets/certs"
|
2022-07-05 20:37:07 +02:00
|
|
|
- "{{ openldap_data }}/ldif/custom-element.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/01_netz39.ldif"
|
|
|
|
timeout: 500
|
|
|
|
command: "--copy-service --loglevel debug"
|
|
|
|
|
2022-07-05 20:52:03 +02:00
|
|
|
- name: Ensure UFW is installed
|
|
|
|
ansible.builtin.package:
|
|
|
|
name: ufw
|
|
|
|
state: present
|
|
|
|
|
2022-07-05 20:37:07 +02:00
|
|
|
- name: Allow access to openLDAP from local docker container [1/2]
|
|
|
|
become: true
|
|
|
|
community.general.ufw:
|
|
|
|
rule: allow
|
|
|
|
port: '389'
|
|
|
|
proto: tcp
|
|
|
|
from: "{{ item }}"
|
|
|
|
comment: LDAP Docker Access
|
|
|
|
loop: "{{ docker_ip_ranges }}"
|
|
|
|
|
|
|
|
- name: Allow access to openLDAP from local docker container [2/2]
|
|
|
|
become: true
|
|
|
|
community.general.ufw:
|
|
|
|
rule: allow
|
|
|
|
port: '636'
|
|
|
|
proto: tcp
|
|
|
|
from: "{{ item }}"
|
|
|
|
comment: LDAP Docker Access
|
|
|
|
loop: "{{ docker_ip_ranges }}"
|
|
|
|
|
2022-09-06 20:31:27 +02:00
|
|
|
|
|
|
|
- name: Ensure container for entities validation service is running
|
|
|
|
docker_container:
|
|
|
|
name: entities_validation_svc
|
|
|
|
image: netz39/entities_validation_svc:v1.0.0
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: yes
|
|
|
|
ports:
|
|
|
|
- "127.0.0.1:{{ entities_validation_svc_host_port }}:8080"
|
|
|
|
restart_policy: unless-stopped
|
2022-11-07 16:43:12 +01:00
|
|
|
env:
|
|
|
|
TZ: "{{ timezone }}"
|
2022-09-06 20:31:27 +02:00
|
|
|
|
|
|
|
- name: Setup proxy site entities-validation.svc.n39.eu
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-09-06 20:31:27 +02:00
|
|
|
vars:
|
|
|
|
site_name: entities-validation.svc.n39.eu
|
|
|
|
proxy_port: "{{ entities_validation_svc_host_port }}"
|
|
|
|
|
2022-06-29 23:55:22 +02:00
|
|
|
handlers:
|