Debian Codegraph @

ansible_collections/microsoft/ad/tests/integration/targets/object/tasks/main.yml

raw
1 - name: add test attributes to the schema
2 object:
3 name: '{{ item.name }}'
4 path: '{{ setup_domain_info.output[0].schemaNamingContext }}'
5 state: present
6 type: attributeSchema
7 attributes:
8 set:
9 adminDescription: '{{ item.description }}'
10 lDAPDisplayName: '{{ item.name }}'
11 attributeId: 1.3.6.1.4.1.2312.99999.{{ item.id }}
12 attributeSyntax: '{{ item.syntax }}'
13 omSyntax: '{{ item.om_syntax }}'
14 isSingleValued: '{{ item.single_value }}'
15 systemOnly: false
16 isMemberOfPartialAttributeSet: false
17 searchFlags: 0
18 showInAdvancedViewOnly: false
19 loop:
20 # https://social.technet.microsoft.com/wiki/contents/articles/52570.active-directory-syntaxes-of-attributes.aspx
21 - name: ansible-BoolSingle
22 description: Test Attribute for Boolean Single
23 id: 1
24 syntax: 2.5.5.8
25 om_syntax: 1
26 single_value: true
27 - name: ansible-BoolMulti
28 description: Test Attribute for Boolean Multi
29 id: 2
30 syntax: 2.5.5.8
31 om_syntax: 1
32 single_value: false
33
34 - name: ansible-BytesSingle
35 description: Test Attribute for Bytes Single
36 id: 3
37 syntax: 2.5.5.10
38 om_syntax: 4
39 single_value: true
40 - name: ansible-BytesMulti
41 description: Test Attribute for Bytes Multi
42 id: 4
43 syntax: 2.5.5.10
44 om_syntax: 4
45 single_value: false
46
47 - name: ansible-DateTimeSingle
48 description: Test Attribute for DateTime Single
49 id: 5
50 syntax: 2.5.5.11
51 om_syntax: 24
52 single_value: true
53 - name: ansible-DateTimeMulti
54 description: Test Attribute for DateTime Multi
55 id: 6
56 syntax: 2.5.5.11
57 om_syntax: 24
58 single_value: false
59
60 - name: ansible-IntSingle
61 description: Test Attribute for Integer Single
62 id: 7
63 syntax: 2.5.5.16
64 om_syntax: 65
65 single_value: true
66 - name: ansible-IntMulti
67 description: Test Attribute for Integer Multi
68 id: 8
69 syntax: 2.5.5.16
70 om_syntax: 65
71 single_value: false
72
73 - name: ansible-SDSingle
74 description: Test Attribute for SD Single
75 id: 9
76 syntax: 2.5.5.15
77 om_syntax: 66
78 single_value: true
79 - name: ansible-SDMulti
80 description: Test Attribute for SD Multi
81 id: 10
82 syntax: 2.5.5.15
83 om_syntax: 66
84 single_value: false
85
86 - name: ansible-StringSingle
87 description: Test Attribute for String Single
88 id: 11
89 syntax: 2.5.5.12
90 om_syntax: 64
91 single_value: true
92 - name: ansible-StringMulti
93 description: Test Attribute for String Multi
94 id: 12
95 syntax: 2.5.5.12
96 om_syntax: 64
97 single_value: false
98
99 register: schema_attributes
100 become: true
101 become_method: runas
102 become_user: SYSTEM
103
104 - name: create auxilary class to house the new attributes
105 object:
106 name: ansibleTesting
107 path: '{{ setup_domain_info.output[0].schemaNamingContext }}'
108 type: classSchema
109 attributes:
110 set:
111 adminDescription: Test auxilary class for Ansible microsoft.ad attribute tests
112 adminDisplayName: ansibleTesting
113 lDAPDisplayName: ansibleTesting
114 governsId: 1.3.6.1.4.1.2312.99999
115 objectClassCategory: 3
116 systemOnly: false
117 subclassOf: top
118 # This is unfortunately not idempotent, the set must be the OID but
119 # Get-ADObject returns the lDAPDisplayName
120 mayContain: '{{ schema_attributes.results | map(attribute="item.id") | map("regex_replace", "^(.*)$", "1.3.6.1.4.1.2312.99999.\1") | list }}'
121 when: schema_attributes is changed
122 register: schema_class
123 become: true
124 become_method: runas
125 become_user: SYSTEM
126
127 - name: add auxilary class to the contact class
128 object:
129 name: Contact
130 path: '{{ setup_domain_info.output[0].schemaNamingContext }}'
131 type: classSchema
132 attributes:
133 add:
134 auxiliaryClass: 1.3.6.1.4.1.2312.99999
135 register: aux_reg
136 become: true
137 become_method: runas
138 become_user: SYSTEM
139 when: schema_class is changed
140
141 - name: update schema
142 ansible.windows.win_powershell:
143 parameters:
144 Name: '{{ setup_domain_info.output[0].dnsHostName }}'
145 script: |
146 param($Name)
147
148 $dse = New-Object -TypeName System.DirectoryServices.DirectoryEntry -ArgumentList "LDAP://$Name/RootDSE"
149 $dse.Put("SchemaUpdateNow", 1)
150 $dse.SetInfo()
151 become: true
152 become_method: runas
153 become_user: SYSTEM
154 when: aux_reg is changed
155
156 - block:
157 - import_tasks: tests.yml
158
159 always:
160 - name: remove temp object
161 object:
162 name: '{{ object_name }}'
163 identity: '{{ object_identity | default(omit) }}'
164 state: absent