An Ansible Playbook to deploy OpenLDAP and FusionDirectory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.3KB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Deploy OpenLDAP/FusionDirectory using Ansible
  2. These Role will deploy an OpenLDAP/FusionDirectory server.
  3. Components:
  4. * OpenLDAP (slapd)
  5. * FusionDirectory
  6. * Apache
  7. * GnuTLS (Internal CA)
  8. ## Prerequisites
  9. * An Ubuntu 18.04 LXD machine.
  10. * The *python-minimal* package needs to be present.
  11. * SSH Public key authentication from the Ansible host, to the mailserver.
  12. ## Clone the repository
  13. Clone the repository:
  14. ```
  15. $ git clone https://git.theo-andreou.org/Personal/ansible-deploy-ldap-fusiondirectory.git
  16. $ cd ansible-deploy-ldap-fusiondirectory
  17. ```
  18. ## Create the vars files
  19. ### Create the vars/all.yml file
  20. * Create a *vars/all.yml* file with similar content (you can use *vars/all.yml.example* as reference):
  21. ```
  22. domain: example.org
  23. organization: Example LTD
  24. description: example
  25. base_dn: dc=example,dc=org
  26. locality: Limassol
  27. state: Limassol
  28. country: CY
  29. allowed_ips:
  30. - 192.168.0.0/24
  31. - 10.0.0.0/24
  32. language: en_US
  33. timezone: Asia/Nicosia
  34. ```
  35. ### Create the vars/secrets.yml filr
  36. * Create an encrypted *vars/secrets.yml* file:
  37. ```
  38. $ ansible-vault create vars/secrets.yml
  39. ```
  40. Use a master password for the file above.
  41. * Create this content:
  42. ```
  43. ldap_admin_dn: cn=admin,dc=example,dc=org
  44. ldap_admin_pass: MySecretLDAPCombination
  45. fd_admin: fdadmin
  46. fd_admin_pass: MySecretFDCombination
  47. ```
  48. * Create a playbook to call this role (fusiondirectory.yml):
  49. ```
  50. - hosts: all
  51. become: yes
  52. gather_facts: false
  53. vars:
  54. - ansible_user: "ubuntu"
  55. pre_tasks:
  56. - name: install python 2
  57. raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
  58. changed_when: False
  59. roles:
  60. - ansible-deploy-ldap-fusiondirectory
  61. ```
  62. ## Deploy LDAP and FusionDirectory
  63. When done with the configuration run this command (provide your master password):
  64. ```
  65. $ ansible-playbook --vault-id @prompt fusiondirectory.yml
  66. ```
  67. When done visit http://auth.example.org to login for the first time. I suggest you enable HTTPS before doing that.
  68. References
  69. ----------
  70. * https://docs.ansible.com/ansible/latest/modules/debconf_module.html
  71. * https://unix.stackexchange.com/questions/126136/how-to-check-debconf-selections-of-a-non-installed-package
  72. * https://serverfault.com/questions/679693/how-do-i-make-ansible-actually-compile-a-config-file-having-changed-my-debconf-s
  73. * https://docs.ansible.com/ansible/latest/modules/template_module.html