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.

118 lines
3.5 KiB

  1. ---
  2. - name: 'populate tree - organization units'
  3. ldap_entry:
  4. dn: 'ou={{ item }},{{ ldap_basedn }}'
  5. objectClass:
  6. - 'organizationalUnit'
  7. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  8. bind_pw: '{{ ldap_passwd }}'
  9. loop:
  10. - 'People'
  11. - 'Group'
  12. - 'Server'
  13. - 'VirtualDomain'
  14. - 'Kerberos'
  15. - name: 'populate tree - virtual domains'
  16. ldap_entry:
  17. dn: 'vd={{ item }},ou=VirtualDomain,{{ ldap_basedn }}'
  18. objectClass:
  19. - 'VirtualDomain'
  20. attributes:
  21. postfixTransport: 'maildrop:'
  22. delete: 'FALSE'
  23. accountActive: 'TRUE'
  24. lastChange: '{{ ansible_date_time.epoch }}'
  25. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  26. bind_pw: '{{ ldap_passwd }}'
  27. loop: '{{ virtual_domains }}'
  28. - name: 'popoulate tree - virtual domain postmasters'
  29. ldap_entry:
  30. dn: 'cn=postmaster,vd={{ item }},ou=VirtualDomain,{{ ldap_basedn }}'
  31. objectClass:
  32. - 'VirtualMailAlias'
  33. attributes:
  34. mail: 'postmaster@{{ item }}'
  35. editAccounts: 'TRUE'
  36. accountActive: 'TRUE'
  37. lastChange: '{{ ansible_date_time.epoch }}'
  38. maildrop: 'postmaster'
  39. sn: 'postmaster'
  40. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  41. bind_pw: '{{ ldap_passwd }}'
  42. loop: '{{ virtual_domains }}'
  43. - name: 'populate tree - posix groups'
  44. ldap_entry:
  45. dn: 'cn={{ item.key }},ou=Group,{{ ldap_basedn }}'
  46. objectClass:
  47. - 'posixGroup'
  48. attributes:
  49. gidNumber: '{{ item.value }}'
  50. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  51. bind_pw: '{{ ldap_passwd }}'
  52. loop: '{{ ldap_groups_posix|dict2items }}'
  53. - name: 'populate tree - name groups'
  54. ldap_entry:
  55. dn: 'cn={{ item }},ou=Group,{{ ldap_basedn }}'
  56. objectClass:
  57. - 'groupOfNames'
  58. attributes:
  59. member: 'cn=admin,{{ ldap_basedn }}'
  60. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  61. bind_pw: '{{ ldap_passwd }}'
  62. loop: '{{ ldap_groups_name }}'
  63. - name: 'provisioning tree - test users'
  64. ldap_entry:
  65. dn: 'uid={{ item.key }},ou=People,{{ ldap_basedn }}'
  66. objectClass:
  67. - 'inetOrgPerson'
  68. - 'authorizedServiceObject'
  69. attributes:
  70. sn: '{{ item.value.sn }}'
  71. mail: '{{ item.value.mail }}'
  72. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  73. bind_pw: '{{ ldap_passwd }}'
  74. loop: '{{ ldap_users_common|dict2items + ldap_users_admin|dict2items }}'
  75. - name: 'provisioning tree - test users passwd'
  76. ldap_passwd:
  77. dn: 'uid={{ item.key }},ou=People,{{ ldap_basedn }}'
  78. passwd: '{{ item.value.password }}'
  79. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  80. bind_pw: '{{ ldap_passwd }}'
  81. loop: '{{ ldap_users_common|dict2items + ldap_users_admin|dict2items }}'
  82. - name: 'provisioning tree - authorizedService'
  83. ldap_attr:
  84. dn: 'uid={{ item.key }},ou=People,{{ ldap_basedn }}'
  85. name: 'authorizedService'
  86. values: '{{ item.value.authorizedServices }}'
  87. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  88. bind_pw: '{{ ldap_passwd }}'
  89. when: item.value.authorizedServices is defined
  90. loop: '{{ ldap_users_common|dict2items + ldap_users_admin|dict2items }}'
  91. - name: 'provisioning tree - admin group members'
  92. ldap_attr:
  93. dn: 'cn=admin,ou=Group,{{ ldap_basedn }}'
  94. name: 'member'
  95. values: 'uid={{ item.key }},ou=People,{{ ldap_basedn }}'
  96. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  97. bind_pw: '{{ ldap_passwd }}'
  98. loop: '{{ ldap_users_admin|dict2items }}'
  99. - name: 'provisioning tree - servers'
  100. ldap_entry:
  101. dn: 'cn={{ item }},ou=Server,{{ ldap_basedn }}'
  102. objectClass:
  103. - 'person'
  104. attributes:
  105. sn: '{{ item }}'
  106. bind_dn: 'cn=admin,{{ ldap_basedn }}'
  107. bind_pw: '{{ ldap_passwd }}'
  108. loop: '{{ ldap_server_accounts }}'
  109. ...