Skip to content

Commit

Permalink
Support for installation on RHEL like target ( and keep Debian too ) #7
Browse files Browse the repository at this point in the history
- Add supported targets and update README with RHEL support.
- minimum changes to get rhel like setup with versions >= 7
 - remove debian setup and dependencies
  • Loading branch information
philhaworteks committed Oct 13, 2023
1 parent 4e87162 commit 2b3cb1a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
OpenLDAP
========

Ansible role which installs and configures [LTB-Project](https://ltb-project.org/)'s OpenLDAP.
Ansible role which installs and configures [LTB-Project](https://ltb-project.org/)'s OpenLDAP on Debian and RHEL like targets.

Requirements
------------

- ansible
- HTTP connection to the LTB-project's repository

Targets OS supported : Debian and RHEL like from version 7.

Role Variables
--------------

You'll need to store the hash value for you admin passwords. You'll get it like this:
You'll need to store the hash value for your admin passwords. You'll get it like this:

```
/usr/local/openldap/sbin/slappasswd -o module-path="/usr/local/openldap/libexec/openldap" -o module-load="argon2" -h "{ARGON2}" -s "password"
Expand Down Expand Up @@ -59,6 +61,23 @@ Run the corresponding task with:
ansible-playbook tests/monitoring.yml -i tests/inventory
```

Test for RHEL
-------------

here sample of what certificates configuration can be :

```
ldaptoolbox_openldap_sslgroup=root
ldaptoolbox_openldap_olcTLSCACertificateFile=/etc/pki/ca-trust/source/anchors/ca-cert.pem
ldaptoolbox_openldap_olcTLSCertificateFile=/etc/pki/tls/certs/ldaps-cert.pem
ldaptoolbox_openldap_olcTLSCertificateKeyFile=/etc/pki/tls/private/ldaps.key"
```

can be run with extra-vars :

```
ansible-playbook tests/standalone.yml -i tests/inventory --ask-vault-pass --extra-vars "ldaptoolbox_openldap_sslgroup=root ldaptoolbox_openldap_olcTLSCACertificateFile=/etc/pki/ca-trust/source/anchors/ca-cert.pem ldaptoolbox_openldap_olcTLSCertificateFile=/etc/pki/tls/certs/ldaps-cert.pem ldaptoolbox_openldap_olcTLSCertificateKeyFile=/etc/pki/tls/private/ldaps.key"
```

License
-------
Expand Down
28 changes: 26 additions & 2 deletions tasks/ldaptoolbox-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,37 @@
- name: fetch repository key
ansible.builtin.shell: "curl {{ ldaptoolbox_openldap_apt_key_url }} | gpg --dearmor > {{ ldaptoolbox_openldap_apt_keyrings_path }}/{{ ldaptoolbox_openldap_apt_repo_filename }}.gpg"

- name: add repository
- name: add debian repository
ansible.builtin.apt_repository:
repo: "{{ ldaptoolbox_openldap_apt_repo }}"
filename: "{{ ldaptoolbox_openldap_apt_repo_filename }}"
update_cache: yes
state: present

when:
- ansible_os_family == "Debian"


- name: centos repository
block:

- name: fetch repository key
ansible.builtin.shell: "rpm --import https://ltb-project.org/documentation/_static/RPM-GPG-KEY-LTB-project"

- name: "setup ldaptoolbox repository on RHEL like version >= 7 "
copy:
content: |
[ltb-project]
name=LTB project packages
baseurl=https://ltb-project.org/rpm/openldap25/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project
dest: /etc/yum.repos.d/ltb-project.repo
when: ( ansible_os_family == "RedHat" ) and ( ansible_distribution_major_version >= "7" )


- name: "unsupported distribution check"
ansible.builtin.debug:
msg: "Unsupported distribution {{ ansible_distribution }} {{ ansible_distribution_major_version }}"
when: not ( (ansible_os_family == "Debian") or ( ( ansible_os_family == "RedHat" ) and ( ansible_distribution_major_version >= "7" ) ) )

2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
package:
name: "{{ ldaptoolbox_openldap_packages_dependencies }}"
state: "{{ ldaptoolbox_openldap_packages_state }}"
when:
- ansible_os_family == "Debian"

- name: install ldaptoolbox repository
include_tasks: ldaptoolbox-repository.yml
Expand Down

0 comments on commit 2b3cb1a

Please sign in to comment.