Playbooks to a new Lilik
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.

89 lines
2.2 KiB

  1. - include_role:
  2. name: service
  3. vars:
  4. service_name: nscd
  5. service_packages: nscd
  6. - name: configure OpenLDAP (domain)
  7. debconf:
  8. name: 'slapd'
  9. question: 'slapd/domain'
  10. vtype: 'string'
  11. value: '{{ ldap_domain }}'
  12. - name: configure OpenLDAP (configure)
  13. debconf:
  14. name: 'slapd'
  15. question: 'slapd/dump_database'
  16. vtype: 'string'
  17. value: 'when needed'
  18. - name: configure OpenLDAP (organization)
  19. debconf:
  20. name: 'slapd'
  21. question: 'shared/organization'
  22. vtype: 'string'
  23. value: '{{ ldap_organization }}'
  24. - name: generate admin password
  25. gen_passwd: length=20
  26. register: new_passwd
  27. - name: configure OpenLDAP (password1)
  28. debconf:
  29. name: 'slapd'
  30. question: 'slapd/password1'
  31. vtype: 'string'
  32. value: '{{ new_passwd.passwd }}'
  33. - name: configure OpenLDAP (password2)
  34. debconf:
  35. name: 'slapd'
  36. question: 'slapd/password2'
  37. vtype: 'string'
  38. value: '{{ new_passwd.passwd }}'
  39. - name: configure phamm-ldap
  40. debconf:
  41. name: 'phamm-ldap'
  42. question: 'phamm-ldap/init_base_ldap'
  43. vtype: 'boolean'
  44. value: false
  45. - include_role:
  46. name: service
  47. vars:
  48. service_name: slapd
  49. service_packages:
  50. - slapd
  51. - ldap-utils
  52. - phamm-ldap
  53. - sudo
  54. - name: upload slapd config
  55. template:
  56. src: slapd.conf.j2
  57. dest: "/etc/ldap/slapd.conf"
  58. - name: update slapd config
  59. shell: slaptest -f /etc/ldap/slapd.conf -F /etc/ldap/slapd.d
  60. args:
  61. creates: "/etc/ldap/slapd.d/cn=config/cn=schema/cn={4}phamm.ldif"
  62. become: true
  63. become_method: sudo
  64. become_user: openldap
  65. notify: restart slapd
  66. - name: fix missing memberOf module load
  67. lineinfile:
  68. dest: /etc/ldap/slapd.d/cn=config/cn=module{0}.ldif
  69. line: "olcModuleLoad: {1}memberof"
  70. notify: restart slapd
  71. - name: upload default tree
  72. template:
  73. dest=/etc/ldap/default_tree.ldif
  74. src=default_tree.ldif.j2
  75. owner=root
  76. group=root
  77. mode=0400
  78. register: upload_default_tree
  79. - name: create default tree
  80. shell: slapadd -l /etc/ldap/default_tree.ldif
  81. when: upload_default_tree.changed
  82. notify: restart slapd
  83. - name: enable OpenLDAP server
  84. service:
  85. name: 'slapd'
  86. enabled: true
  87. state: started