Skip to content

Commit

Permalink
Merge pull request #13 from ktooi/add_os_support
Browse files Browse the repository at this point in the history
Add os support
  • Loading branch information
ktooi authored Oct 13, 2022
2 parents 5ec0696 + a82bc98 commit 203cf1f
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
fail-fast: false
matrix:
distro:
- rockylinux9
- rockylinux8
- centos7
- ubuntu2204
- ubuntu2004
Expand Down
14 changes: 8 additions & 6 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ galaxy_info:
platforms:
- name: EL
versions:
- 9
- 8
- 7
# - 8
# - name: Archlinux
# versions:
# - all
- name: Ubuntu
versions:
- all
- 'jammy' # 22.04
- 'focal' # 20.04
- 'bionic' # 18.04
- name: Debian
versions:
- all
- 'bullseye' # 11
- 'buster' # 10
- 'stretch' # 9
galaxy_tags:
- ldap
- openldap
Expand Down
11 changes: 11 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ provisioner:
url: 'ldap://ldap01.test.example.com'
- id: 2
url: 'ldap://ldap02.test.example.com'
# https://github.com/ktooi/ansible-role-slapd/issues/12
rockylinux9:
slapd_install_module_refint: false
slapd_install_module_memberof: false
slapd_install_module_syncprov: false
slapd_replication: false
rockylinux8:
slapd_install_module_refint: false
slapd_install_module_memberof: false
slapd_install_module_syncprov: false
slapd_replication: false
centos7:
slapd_install_module_refint: false
slapd_install_module_memberof: false
Expand Down
7 changes: 3 additions & 4 deletions tasks/configure-admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
olcRootDN: '{{ ldap_admin_dn }}'
olcRootPW: '{{ ldap_admin_hashed_passwd }}'
state: exact
# WORKAROUND: Skip this task due to the following error occurred at RedHat 7
# WORKAROUND: Skip this task due to the following error occurred at RedHat 7/8/9
# OTHER: {'info': '<olcModuleLoad> handler exited with 1', 'desc': 'Other (e.g., implementation specific) error'}
when: >-
not ( ansible_os_family == "RedHat"
and ansible_distribution_major_version == "7" )
# See also: https://github.com/ktooi/ansible-role-slapd/issues/11
when: not ansible_os_family == "RedHat"
tags:
- molecule-idempotence-notest
31 changes: 31 additions & 0 deletions tasks/setup-RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Install LDAP packages.
become: true
dnf:
name: "{{ ldap_server_packages }}"
enablerepo: "{{ ldap_server_repo | default(omit) }}"

- name: Install python packages for LDAP.
become: true
dnf:
name: "{{ ldap_python_modules }}"
when: not slapd_install_python_module_via_pip

- name: Install python packages for LDAP using pip.
become: true
pip:
name: "{{ ldap_python_modules_pip }}"
when: slapd_install_python_module_via_pip

- name: Copy DB_CONFIG
become: true
template:
src: DB_CONFIG.j2
dest: "{{ ldap_server_db_config_file }}"

- name: Start the slapd daemon.
become: true
systemd:
name: "{{ slapd_daemon }}"
enabled: true
state: started
18 changes: 18 additions & 0 deletions tasks/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@
tags:
- always

- name: Define ldap_server_repo
set_fact:
ldap_server_repo: "{{ __ldap_server_repo }}"
when:
- ldap_server_repo is not defined
- __ldap_server_repo is defined
tags:
- always

- name: Define ldap_server_db_config_file
set_fact:
ldap_server_db_config_file: "{{ __ldap_server_db_config_file }}"
when:
- ldap_server_db_config_file is not defined
- __ldap_server_db_config_file is defined
tags:
- always

- name: Define ldap_python_modules
set_fact:
ldap_python_modules: "{{ __ldap_python_modules | list }}"
Expand Down
10 changes: 10 additions & 0 deletions templates/DB_CONFIG.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# one 0.25 GB cache
set_cachesize 0 268435456 1

# Data Directory
#set_data_dir db

# Transaction Log settings
set_lg_regionmax 262144
set_lg_bsize 2097152
#set_lg_dir logs
22 changes: 22 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
__ldap_server_packages:
- openldap-servers
- openldap-clients
__ldap_server_repo: plus
__ldap_server_db_config_file: "/var/lib/ldap/DB_CONFIG"
__ldap_python_modules:
- python3-ldap
__ldap_python_modules_pip:
- python-ldap
__ldap_cmd_ldapmodify: "/usr/bin/ldapmodify"
__ldap_cmd_ldapadd: "/usr/bin/ldapadd"
__slapd_install_python_module_via_pip: false
__ldap_owner: "openldap"
__ldap_group: "openldap"
__ldap_conf_file: "/etc/openldap/ldap.conf"
__slapd_daemon: "slapd"
__slapd_conf_file: "/etc/ldap/slap.conf"
__slapd_module_path: "/usr/lib/ldap"
__slapd_db_type: "mdb"
__slapd_cmd_slappasswd: "/usr/sbin/slappasswd"
__slapd_cmd_slapcat: "/usr/sbin/slapcat"

0 comments on commit 203cf1f

Please sign in to comment.