solo configurar container
This commit is contained in:
@@ -1,43 +1,5 @@
|
||||
---
|
||||
# Playbook for setting up a Docker container with openLDAP.
|
||||
# A port binding to the Docker host is required for setting
|
||||
# up domains and replication.
|
||||
|
||||
- name: instalar dependencias
|
||||
apt:
|
||||
name:
|
||||
- ldap-utils
|
||||
- build-essential
|
||||
- libldap2-dev
|
||||
- libsasl2-dev
|
||||
state: present
|
||||
|
||||
- name: instalar dependencias
|
||||
pip: name=python-ldap state=present
|
||||
|
||||
- name: "Create directory for building image"
|
||||
file:
|
||||
path: "/tmp/build.openldap-image"
|
||||
state: "directory"
|
||||
|
||||
- name: "Copy required files"
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/tmp/build.openldap-image/"
|
||||
loop:
|
||||
- "Dockerfile"
|
||||
- "entrypoint.sh"
|
||||
register: cpfiles
|
||||
|
||||
- name: "Build openldap image"
|
||||
docker_image:
|
||||
path: "/tmp/build.openldap-image"
|
||||
name: "{{ openldap_image_name }}"
|
||||
# force_source on Ansible 2.8
|
||||
force: "{{ cpfiles is changed }}"
|
||||
register: imgbuild
|
||||
|
||||
- name: "Start openldap container"
|
||||
- name: Start openldap container
|
||||
docker_container:
|
||||
image: "{{ openldap_image_name }}"
|
||||
name: "{{ openldap_container_name }}"
|
||||
@@ -46,9 +8,16 @@
|
||||
- "{{ openldap_volume_data }}:/var/lib/ldap"
|
||||
- "{{ openldap_volume_backup }}:/var/backups/ldap"
|
||||
env:
|
||||
OPENLDAP_ADMIN_PASSWORD: "{{ openldap_admin_password }}"
|
||||
OPENLDAP_SCHEMAS: "{{ openldap_schemas | join (' ') }}"
|
||||
OPENLDAP_ENABLE_MEMBEROF: "{{ 'true' if openldap_enable_memberof else 'false' }}"
|
||||
LDAP_CONFIG_PASSWORD: "{{ openldap_config_password }}"
|
||||
LDAP_ADMIN_CN: "{{ openldap_admin_cn }}"
|
||||
LDAP_ADMIN_PASSWORD: "{{ openldap_admin_password }}"
|
||||
LDAP_MEMBEROF: "{{ 'true' if openldap_enable_memberof else 'false' }}"
|
||||
LDAP_DOMAIN: "{{ openldap_domain }}"
|
||||
LDAP_DOMAIN_ACCESS: "{{ openldap_domain_access | join('\\n') }}"
|
||||
LDAP_DOMAIN_INDEX: "{{ openldap_domain_index | join('\\n') }}"
|
||||
LDAP_DOMAIN_LIMITS: "{{ openldap_domain_limits | join('\\n') }}"
|
||||
LDAP_DOMAIN_OUS: "{{ openldap_domain_ous | join(' ') }}"
|
||||
LDAP_SCHEMAS: "{{ openldap_schemas | join (' ') }}"
|
||||
|
||||
networks:
|
||||
- name: "{{ docker_network_name }}"
|
||||
@@ -56,27 +25,6 @@
|
||||
- "{{ openldap_bind_host }}:{{ openldap_bind_port }}:389"
|
||||
recreate: "{{ imgbuild is changed }}"
|
||||
|
||||
- name: Wait for server
|
||||
ldap:
|
||||
state: search
|
||||
dn: cn=config
|
||||
objectClass: olcDatabaseConfig
|
||||
filter: "(olcSuffix=*)"
|
||||
bind_dn: cn=admin,cn=config
|
||||
bind_pw: "{{ openldap_admin_password }}"
|
||||
server_uri: ldap://localhost:{{ openldap_bind_port }}
|
||||
register: res
|
||||
until: res is not failed
|
||||
retries: 20
|
||||
|
||||
- include_tasks: provider.yml
|
||||
when: openldap_provider == True
|
||||
|
||||
- include_tasks: domain.yml
|
||||
loop: "{{ openldap_domains }}"
|
||||
loop_control:
|
||||
loop_var: domain
|
||||
|
||||
- set_fact:
|
||||
ldap_container: "{{ lookup( 'vars', 'openldap_container_name') }}"
|
||||
ldap_port: "389"
|
||||
|
||||
Reference in New Issue
Block a user