|
25 | 25 | enabled: true
|
26 | 26 | identity: CN=stackable-secret-operator,CN=Users,DC=sble,DC=test
|
27 | 27 | upn: "{{ secret_operator_principal }}"
|
28 |
| - groups: |
29 |
| - add: |
30 |
| - - Domain Admins |
| 28 | + register: secret_operator_user |
31 | 29 | - name: Create Secret-Operator Keytab
|
32 | 30 | ansible.windows.win_command:
|
33 | 31 | cmd: ktpass /princ {{ secret_operator_principal }} /out secret-op.kt +rndPass /ptype KRB5_NT_PRINCIPAL /mapuser {{ secret_operator_principal }} /crypto AES256-SHA1
|
|
37 | 35 | dest: target/
|
38 | 36 | flat: true
|
39 | 37 |
|
| 38 | +- name: Create SDP Organizational Unit |
| 39 | + microsoft.ad.ou: |
| 40 | + name: SDP |
| 41 | + register: sdp_ou |
| 42 | +- name: Grant permissions on SDP Organizational Unit |
| 43 | + ansible.windows.win_shell: | |
| 44 | + # In theory this could be done declaratively by setting the nTSecurityDescriptor before, but that turned out to be a mess... |
| 45 | + Import-Module ActiveDirectory |
| 46 | + $ou_path = "AD:{{ sdp_ou.distinguished_name }}" |
| 47 | + $secretop = [System.Security.Principal.SecurityIdentifier]::New("{{ secret_operator_user.sid }}") |
| 48 | + $acl = Get-ACL -Path $ou_path |
| 49 | + $user_schema_guid = "bf967aba-0de6-11d0-a285-00aa003049e2" |
| 50 | + $password_reset_right_guid = "00299570-246d-11d0-a768-00aa006e0529" |
| 51 | + $ou_create_children_rule = [System.DirectoryServices.ActiveDirectoryAccessRule]::New( |
| 52 | + $secretop, |
| 53 | + [System.DirectoryServices.ActiveDirectoryRights]::CreateChild, |
| 54 | + [System.Security.AccessControl.AccessControlType]::Allow, |
| 55 | + $user_schema_guid, |
| 56 | + [System.DirectoryServices.ActiveDirectorySecurityInheritance]::None |
| 57 | + ) |
| 58 | + $ou_reset_passwords_rule = [System.DirectoryServices.ExtendedRightAccessRule]::New( |
| 59 | + $secretop, |
| 60 | + [System.Security.AccessControl.AccessControlType]::Allow, |
| 61 | + $password_reset_right_guid, |
| 62 | + [System.DirectoryServices.ActiveDirectorySecurityInheritance]::Children |
| 63 | + ) |
| 64 | + $acl.AddAccessRule($ou_create_children_rule) |
| 65 | + $acl.AddAccessRule($ou_reset_passwords_rule) |
| 66 | + Set-ACL -Path $ou_path -AclObject $acl |
| 67 | +
|
40 | 68 | - name: Install AD Certificate Services
|
41 | 69 | ansible.windows.win_feature:
|
42 | 70 | name:
|
|
0 commit comments