- name: create contact object - check object: name: '{{ object_name }}' type: contact state: present register: create_check check_mode: true - name: get result of create contact object - check object_info: identity: '{{ create_check.distinguished_name }}' register: create_check_actual - name: assert create contact object - check assert: that: - create_check is changed - create_check.distinguished_name == object_dn - create_check.object_guid == '00000000-0000-0000-0000-000000000000' - create_check_actual.objects == [] - name: create contact object object: name: '{{ object_name }}' type: contact state: present register: create - name: get result of create contact object object_info: identity: '{{ create_check.distinguished_name }}' properties: - objectClass register: create_actual - name: assert create contact object assert: that: - create is changed - create_actual.objects | length == 1 - create_actual.objects[0].ObjectClass == 'contact' - create.distinguished_name == object_dn - create.distinguished_name == create_actual.objects[0].DistinguishedName - create.object_guid == create_actual.objects[0].ObjectGUID - set_fact: object_identity: '{{ create.object_guid }}' - name: create contact object - idempotent object: name: '{{ object_name }}' type: contact state: present register: create_again - name: assert create contact object - idempotent assert: that: - not create_again is changed - create_again.distinguished_name == create_actual.objects[0].DistinguishedName - create_again.object_guid == create_actual.objects[0].ObjectGUID - name: fail to change type object: name: '{{ object_name }}' state: present type: failure register: fail_change_type failed_when: fail_change_type.msg != "Cannot change object type contact of existing object " ~ object_dn ~ " to failure" - name: rename and set display name of object - check object: name: My, Contact 2 identity: '{{ object_identity }}' display_name: Display Name state: present type: contact register: rename_check check_mode: true - name: get result of create contact object - check object_info: identity: '{{ object_identity }}' properties: - displayName - name register: rename_check_actual - name: assert rename and set display name of object - check assert: that: - rename_check is changed - rename_check.distinguished_name == 'CN=My\, Contact 2,' ~ setup_domain_info.output[0].defaultNamingContext - rename_check.object_guid == object_identity - rename_check_actual.objects[0].DisplayName == None - rename_check_actual.objects[0].DistinguishedName == object_dn - rename_check_actual.objects[0].Name == object_name - name: rename and set display name of object object: name: My, Contact 2 identity: '{{ object_identity }}' display_name: Display Name state: present type: contact register: rename - name: get result of create contact object object_info: identity: '{{ object_identity }}' properties: - displayName - name register: rename_actual - name: assert rename and set display name of object assert: that: - rename is changed - rename.distinguished_name == 'CN=My\, Contact 2,' ~ setup_domain_info.output[0].defaultNamingContext - rename.object_guid == object_identity - rename_actual.objects[0].DisplayName == 'Display Name' - rename_actual.objects[0].DistinguishedName == 'CN=My\, Contact 2,' ~ setup_domain_info.output[0].defaultNamingContext - rename_actual.objects[0].Name == 'My, Contact 2' - name: rename and set display name of object - idempotent object: name: My, Contact 2 identity: '{{ object_identity }}' display_name: Display Name state: present type: contact register: rename_again - name: assert rename and set display name of object - idempotent assert: that: - not rename_again is changed - rename_again.distinguished_name == 'CN=My\, Contact 2,' ~ setup_domain_info.output[0].defaultNamingContext - rename_again.object_guid == object_identity - name: move and set description - check object: name: My, Contact 2 identity: '{{ object_identity }}' path: CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} description: My Description state: present type: contact register: move_check check_mode: true - name: move and set description - check object_info: identity: '{{ object_identity }}' properties: - description - name register: move_check_actual - name: assert move and set description - check assert: that: - move_check is changed - move_check.distinguished_name == 'CN=My\, Contact 2,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - move_check.object_guid == object_identity - move_check_actual.objects[0].Description == None - move_check_actual.objects[0].DistinguishedName == 'CN=My\, Contact 2,' ~ setup_domain_info.output[0].defaultNamingContext - move_check_actual.objects[0].Name == 'My, Contact 2' - name: move and set description object: name: My, Contact 2 identity: '{{ object_identity }}' path: CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} description: My Description state: present type: contact register: move - name: move and set description object_info: identity: '{{ object_identity }}' properties: - description - name register: move_actual - name: assert move and set description assert: that: - move is changed - move.distinguished_name == 'CN=My\, Contact 2,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - move.object_guid == object_identity - move_actual.objects[0].Description == 'My Description' - move_actual.objects[0].DistinguishedName == 'CN=My\, Contact 2,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - move_actual.objects[0].Name == 'My, Contact 2' - name: move and set description - idempotent object: name: My, Contact 2 identity: '{{ object_identity }}' path: CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} description: My Description state: present type: contact register: move_again - name: assert move and set description - idempotent assert: that: - not move_again is changed - move_again.distinguished_name == 'CN=My\, Contact 2,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - move_again.object_guid == object_identity - name: rename and move - check object: name: '{{ object_name }}' identity: '{{ object_identity }}' path: '{{ setup_domain_info.output[0].defaultNamingContext }}' state: present type: contact register: rename_and_move_check check_mode: true - name: get result of rename and move - check object_info: identity: '{{ object_identity }}' register: rename_and_move_check_actual - name: assert rename and move - check assert: that: - rename_and_move_check is changed - rename_and_move_check.distinguished_name == object_dn - rename_and_move_check.object_guid == object_identity - rename_and_move_check_actual.objects[0].DistinguishedName == 'CN=My\, Contact 2,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - rename_and_move_check_actual.objects[0].Name == 'My, Contact 2' - name: rename and move object: name: '{{ object_name }}' identity: '{{ object_identity }}' path: '{{ setup_domain_info.output[0].defaultNamingContext }}' state: present type: contact register: rename_and_move - name: get result of rename and move object_info: identity: '{{ object_identity }}' register: rename_and_move_actual - name: assert rename and move assert: that: - rename_and_move is changed - rename_and_move.distinguished_name == object_dn - rename_and_move.object_guid == object_identity - rename_and_move_actual.objects[0].DistinguishedName == object_dn - rename_and_move_actual.objects[0].Name == object_name - name: remove object by name - check object: name: '{{ object_name }}' state: absent register: remove_check check_mode: true - name: get result of remove by name - check object_info: identity: '{{ object_identity }}' register: remove_check_actual - name: assert remove object by name - check assert: that: - remove_check is changed - remove_check.distinguished_name == object_dn - remove_check.object_guid == object_identity - remove_check_actual.objects | length == 1 - name: remove object by name object: name: '{{ object_name }}' state: absent register: remove - name: get result of remove by name object_info: identity: '{{ object_identity }}' register: remove_actual - name: assert remove object by name - check assert: that: - remove is changed - remove.distinguished_name == object_dn - remove.object_guid == object_identity - remove_actual.objects == [] - name: remove object by name - idempotent object: name: '{{ object_name }}' state: absent register: remove_again - name: assert remove object by name - check assert: that: - not remove_again is changed - remove_again.distinguished_name == None - remove_again.object_guid == None - name: create object protected from deletion object: name: My, Container state: present type: organizationalUnit protect_from_deletion: true register: create_deletion - set_fact: object_identity: '{{ create_deletion.object_guid }}' - name: get result of create object protected from deletion object_info: identity: '{{ object_identity }}' properties: - ProtectedFromAccidentalDeletion register: create_deletion_actual - name: assert create object protected from deletion assert: that: - create_deletion is changed - create_deletion.distinguished_name == 'OU=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - create_deletion_actual.objects[0].ProtectedFromAccidentalDeletion == true - name: unset protect from deletion object: name: My, Container state: present type: organizationalUnit protect_from_deletion: false register: unset_deletion - name: get result of unset protect from deletion object_info: identity: '{{ object_identity }}' properties: - ProtectedFromAccidentalDeletion register: unset_deletion_actual - name: assert set protect from deletion assert: that: - unset_deletion is changed - unset_deletion.distinguished_name == 'OU=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - unset_deletion_actual.objects[0].ProtectedFromAccidentalDeletion == false - name: set protect from deletion object: name: My, Container state: present type: organizationalUnit protect_from_deletion: true register: set_deletion - name: get result of set protect from deletion object_info: identity: '{{ object_identity }}' properties: - ProtectedFromAccidentalDeletion register: set_deletion_actual - name: assert set protect from deletion assert: that: - set_deletion is changed - set_deletion.distinguished_name == 'OU=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - set_deletion_actual.objects[0].ProtectedFromAccidentalDeletion == true - name: create sub ous for move test ou: name: '{{ item }}' path: '{{ set_deletion.distinguished_name }}' state: present protect_from_deletion: true register: sub_ous loop: - SubOU - TestOU - name: move and rename object that is protected from deletion - check object: name: TestOU 2 path: '{{ sub_ous.results[0].distinguished_name }}' identity: '{{ sub_ous.results[1].object_guid }}' type: organizationalUnit register: move_ou_check check_mode: true - name: get result of move and rename object that is protected from deletion - check object_info: identity: '{{ sub_ous.results[1].object_guid }}' properties: - ProtectedFromAccidentalDeletion register: move_ou_check_actual - name: assert move and rename object that is protected from deletion - check assert: that: - move_ou_check is changed - move_ou_check.distinguished_name == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - move_ou_check_actual.objects[0].Name == 'TestOU' - move_ou_check_actual.objects[0].DistinguishedName == sub_ous.results[1].distinguished_name - move_ou_check_actual.objects[0].ProtectedFromAccidentalDeletion == true - name: move and rename object that is protected from deletion object: name: TestOU 2 path: '{{ sub_ous.results[0].distinguished_name }}' identity: '{{ sub_ous.results[1].object_guid }}' type: organizationalUnit register: move_ou - name: get result of move and rename object that is protected from deletion object_info: identity: '{{ sub_ous.results[1].object_guid }}' properties: - ProtectedFromAccidentalDeletion register: move_ou_actual - name: assert move and rename object that is protected from deletion assert: that: - move_ou is changed - move_ou.distinguished_name == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - move_ou_actual.objects[0].Name == 'TestOU 2' - move_ou_actual.objects[0].DistinguishedName == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - move_ou_actual.objects[0].ProtectedFromAccidentalDeletion == true - name: do not move object in non default path without path - check object: name: TestOU 2 identity: '{{ sub_ous.results[1].object_guid }}' type: organizationalUnit attributes: set: description: Test comment register: dont_move_no_path_check check_mode: true - name: get result of do not move object in non default path without path - check object_info: identity: '{{ sub_ous.results[1].object_guid }}' properties: - description register: dont_move_no_path_check_actual - name: assert do not move object in non default path without path - check assert: that: - dont_move_no_path_check is changed - dont_move_no_path_check.distinguished_name == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - dont_move_no_path_check_actual.objects[0].Name == 'TestOU 2' - dont_move_no_path_check_actual.objects[0].DistinguishedName == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - dont_move_no_path_check_actual.objects[0].Description == None - name: do not move object in non default path without path object: name: TestOU 2 identity: '{{ sub_ous.results[1].object_guid }}' type: organizationalUnit attributes: set: description: Test comment register: dont_move_no_path - name: get result of do not move object in non default path without path object_info: identity: '{{ sub_ous.results[1].object_guid }}' properties: - description register: dont_move_no_path_actual - name: assert do not move object in non default path without path - check assert: that: - dont_move_no_path is changed - dont_move_no_path.distinguished_name == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - dont_move_no_path_actual.objects[0].Name == 'TestOU 2' - dont_move_no_path_actual.objects[0].DistinguishedName == 'OU=TestOU 2,' ~ sub_ous.results[0].distinguished_name - dont_move_no_path_actual.objects[0].Description == 'Test comment' - name: remove object that is protected from deletion - check object: name: My, Container state: absent type: organizationalUnit register: remove_deletion_check check_mode: true - name: get result of remove object that is protected from deletion - check object_info: identity: '{{ object_identity }}' properties: - ProtectedFromAccidentalDeletion register: remove_deletion_actual_check - name: assert remove object that is protected from deletion - check assert: that: - remove_deletion_check is changed - remove_deletion_check.distinguished_name == 'OU=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - remove_deletion_actual_check.objects[0].ProtectedFromAccidentalDeletion == true - name: remove object that is protected from deletion object: name: My, Container state: absent type: organizationalUnit register: remove_deletion - name: get result of remove object that is protected from deletion object_info: identity: '{{ object_identity }}' register: remove_deletion_actual - name: assert remove object that is protected from deletion assert: that: - remove_deletion is changed - remove_deletion.distinguished_name == 'OU=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - remove_deletion_actual.objects == [] - name: create object with custom path, description, and display_name object: name: My, Container description: Test Description display_name: Display Name path: CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} state: present type: container register: create_custom - set_fact: object_identity: '{{ create_custom.object_guid }}' - name: get result of create object with custom path, description, and display_name object_info: identity: '{{ object_identity }}' properties: - description - displayName - objectClass register: create_custom_actual - name: assert create object with custom path, description, and display_name assert: that: - create_custom is changed - create_custom.distinguished_name == 'CN=My\, Container,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - create_custom.object_guid == object_identity - create_custom_actual.objects[0].Description == 'Test Description' - create_custom_actual.objects[0].DisplayName == 'Display Name' - create_custom_actual.objects[0].ObjectClass == 'container' - name: create child object in container with attributes object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} description: Test Description display_name: Display Name attributes: add: ansible-BoolSingle: false ansible-BoolMulti: - false - true ansible-BytesSingle: type: bytes value: Zm9v ansible-BytesMulti: - type: bytes value: Zm9v - type: bytes value: YmFy ansible-DateTimeSingle: type: date_time value: '1970-01-01T00:00:00Z' ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00+01:00' - type: date_time value: '1601-01-01T00:00:00.1-01:00' ansible-IntSingle: 0 ansible-IntMulti: - 0 - 1 ansible-SDSingle: type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD) ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU) ansible-StringSingle: single ansible-StringMulti: - multi 1 - multi 2 type: contact state: present register: sub_object - name: get result of child object attributes object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolSingle - ansible-BoolMulti - ansible-BytesSingle - ansible-BytesMulti - ansible-DateTimeSingle - ansible-DateTimeMulti - ansible-IntSingle - ansible-IntMulti - ansible-SDSingle - ansible-SDMulti - ansible-StringSingle - ansible-StringMulti register: sub_object_actual - name: assert create child object in container with attributes assert: that: - sub_object is changed - sub_object.distinguished_name == 'CN=Contact,CN=My\, Container,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - sub_object_actual.objects[0]['ansible-BoolSingle'] == False - sub_object_actual.objects[0]['ansible-BoolMulti'] | length == 2 - True in sub_object_actual.objects[0]['ansible-BoolMulti'] - False in sub_object_actual.objects[0]['ansible-BoolMulti'] - sub_object_actual.objects[0]['ansible-BytesSingle'] == "Zm9v" - sub_object_actual.objects[0]['ansible-BytesMulti'] | length == 2 - "'YmFy' in sub_object_actual.objects[0]['ansible-BytesMulti']" - "'Zm9v' in sub_object_actual.objects[0]['ansible-BytesMulti']" - sub_object_actual.objects[0]['ansible-DateTimeSingle'] == "1970-01-01T00:00:00.0000000Z" - sub_object_actual.objects[0]['ansible-DateTimeMulti'] | length == 2 - "'1601-01-01T01:00:00.0000000Z' in sub_object_actual.objects[0]['ansible-DateTimeMulti']" - "'1969-12-31T23:00:00.0000000Z' in sub_object_actual.objects[0]['ansible-DateTimeMulti']" - sub_object_actual.objects[0]['ansible-IntSingle'] == 0 - sub_object_actual.objects[0]['ansible-IntMulti'] | length == 2 - 0 in sub_object_actual.objects[0]['ansible-IntMulti'] - 1 in sub_object_actual.objects[0]['ansible-IntMulti'] - sub_object_actual.objects[0]['ansible-SDSingle'] == "O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)" - sub_object_actual.objects[0]['ansible-SDMulti'] | length == 2 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in sub_object_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)' in sub_object_actual.objects[0]['ansible-SDMulti']" - sub_object_actual.objects[0]['ansible-StringSingle'] == "single" - sub_object_actual.objects[0]['ansible-StringMulti'] | length == 2 - "'multi 1' in sub_object_actual.objects[0]['ansible-StringMulti']" - "'multi 2' in sub_object_actual.objects[0]['ansible-StringMulti']" - name: add attribute - check object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact description: test description display_name: display name attributes: add: ansible-BoolMulti: - false - true ansible-BytesMulti: - type: bytes value: Zm9v - type: bytes value: dGVzdA== - type: bytes value: Y2FmZQ== ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00+01:00' - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '2023-01-17T16:00:31+00:30' ansible-IntMulti: - 0 - 2 - 3 ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG) ansible-StringMulti: - multi 1 - '3' - '4' state: present register: add_attr_check check_mode: true - name: get result of add attribute - check object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolMulti - ansible-BytesMulti - ansible-DateTimeMulti - ansible-IntMulti - ansible-SDMulti - ansible-StringMulti register: add_attr_check_actual - name: assert add attribute - check assert: that: - add_attr_check is changed - add_attr_check_actual.objects[0]['ansible-BoolMulti'] | length == 2 - True in add_attr_check_actual.objects[0]['ansible-BoolMulti'] - False in add_attr_check_actual.objects[0]['ansible-BoolMulti'] - add_attr_check_actual.objects[0]['ansible-BytesMulti'] | length == 2 - "'YmFy' in add_attr_check_actual.objects[0]['ansible-BytesMulti']" - "'Zm9v' in add_attr_check_actual.objects[0]['ansible-BytesMulti']" - add_attr_check_actual.objects[0]['ansible-DateTimeMulti'] | length == 2 - "'1601-01-01T01:00:00.0000000Z' in add_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - "'1969-12-31T23:00:00.0000000Z' in add_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - add_attr_check_actual.objects[0]['ansible-IntMulti'] | length == 2 - 0 in add_attr_check_actual.objects[0]['ansible-IntMulti'] - 1 in add_attr_check_actual.objects[0]['ansible-IntMulti'] - add_attr_check_actual.objects[0]['ansible-SDMulti'] | length == 2 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in add_attr_check_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)' in add_attr_check_actual.objects[0]['ansible-SDMulti']" - add_attr_check_actual.objects[0]['ansible-StringMulti'] | length == 2 - "'multi 1' in add_attr_check_actual.objects[0]['ansible-StringMulti']" - "'multi 2' in add_attr_check_actual.objects[0]['ansible-StringMulti']" - name: add attribute object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact description: test description display_name: display name attributes: add: ansible-BoolMulti: - false - true ansible-BytesMulti: - type: bytes value: Zm9v - type: bytes value: dGVzdA== - type: bytes value: Y2FmZQ== ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00+01:00' - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '2023-01-17T16:00:31+00:30' ansible-IntMulti: - 0 - 2 - 3 ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG) ansible-StringMulti: - multi 1 - '3' - '4' state: present register: add_attr - name: get result of add attribute object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolMulti - ansible-BytesMulti - ansible-DateTimeMulti - ansible-IntMulti - ansible-SDMulti - ansible-StringMulti register: add_attr_actual - name: assert add attribute assert: that: - add_attr is changed - add_attr_actual.objects[0]['ansible-BoolMulti'] | length == 2 - True in add_attr_actual.objects[0]['ansible-BoolMulti'] - False in add_attr_actual.objects[0]['ansible-BoolMulti'] - add_attr_actual.objects[0]['ansible-BytesMulti'] | length == 4 - "'YmFy' in add_attr_actual.objects[0]['ansible-BytesMulti']" - "'Zm9v' in add_attr_actual.objects[0]['ansible-BytesMulti']" - "'dGVzdA==' in add_attr_actual.objects[0]['ansible-BytesMulti']" - "'Y2FmZQ==' in add_attr_actual.objects[0]['ansible-BytesMulti']" - add_attr_actual.objects[0]['ansible-DateTimeMulti'] | length == 4 - "'1601-01-01T01:00:00.0000000Z' in add_attr_actual.objects[0]['ansible-DateTimeMulti']" - "'1969-12-31T23:00:00.0000000Z' in add_attr_actual.objects[0]['ansible-DateTimeMulti']" - "'1970-01-01T00:00:00.0000000Z' in add_attr_actual.objects[0]['ansible-DateTimeMulti']" - "'2023-01-17T15:30:31.0000000Z' in add_attr_actual.objects[0]['ansible-DateTimeMulti']" - add_attr_actual.objects[0]['ansible-IntMulti'] | length == 4 - 0 in add_attr_actual.objects[0]['ansible-IntMulti'] - 1 in add_attr_actual.objects[0]['ansible-IntMulti'] - 2 in add_attr_actual.objects[0]['ansible-IntMulti'] - 3 in add_attr_actual.objects[0]['ansible-IntMulti'] - add_attr_actual.objects[0]['ansible-SDMulti'] | length == 4 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in add_attr_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)' in add_attr_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC)' in add_attr_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG)' in add_attr_actual.objects[0]['ansible-SDMulti']" - add_attr_actual.objects[0]['ansible-StringMulti'] | length == 4 - "'multi 1' in add_attr_actual.objects[0]['ansible-StringMulti']" - "'multi 2' in add_attr_actual.objects[0]['ansible-StringMulti']" - "'3' in add_attr_actual.objects[0]['ansible-StringMulti']" - "'4' in add_attr_actual.objects[0]['ansible-StringMulti']" - name: add attribute - idempotent object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact description: test description display_name: display name attributes: add: ansible-BoolMulti: - false - true ansible-BytesMulti: - type: bytes value: Zm9v - type: bytes value: dGVzdA== - type: bytes value: Y2FmZQ== ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00+01:00' - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '2023-01-17T16:00:31+00:30' ansible-IntMulti: - 0 - 2 - 3 ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG) ansible-StringMulti: - multi 1 - '3' - '4' state: present register: add_attr_again - name: assert add attribute - idempotent assert: that: - not add_attr_again is changed - name: remove attribute - check object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: remove: ansible-BoolMulti: - type: bool value: '' # Will be false when casted ansible-BytesMulti: - type: bytes value: dGVzdA== - type: bytes value: Y2FmZQ== ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '2023-01-17T16:00:31+00:30' ansible-IntMulti: - type: int value: '2' - type: raw value: 3 ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG) ansible-StringMulti: - multi 1 - type: string value: 3 - type: raw value: '4' state: present register: remove_attr_check check_mode: true - name: get result of remove attribute - check object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolMulti - ansible-BytesMulti - ansible-DateTimeMulti - ansible-IntMulti - ansible-SDMulti - ansible-StringMulti register: remove_attr_check_actual - name: assert remove attribute - check assert: that: - remove_attr_check is changed - remove_attr_check_actual.objects[0]['ansible-BoolMulti'] | length == 2 - True in remove_attr_check_actual.objects[0]['ansible-BoolMulti'] - False in remove_attr_check_actual.objects[0]['ansible-BoolMulti'] - remove_attr_check_actual.objects[0]['ansible-BytesMulti'] | length == 4 - "'YmFy' in remove_attr_check_actual.objects[0]['ansible-BytesMulti']" - "'Zm9v' in remove_attr_check_actual.objects[0]['ansible-BytesMulti']" - "'dGVzdA==' in remove_attr_check_actual.objects[0]['ansible-BytesMulti']" - "'Y2FmZQ==' in remove_attr_check_actual.objects[0]['ansible-BytesMulti']" - remove_attr_check_actual.objects[0]['ansible-DateTimeMulti'] | length == 4 - "'1601-01-01T01:00:00.0000000Z' in remove_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - "'1969-12-31T23:00:00.0000000Z' in remove_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - "'1970-01-01T00:00:00.0000000Z' in remove_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - "'2023-01-17T15:30:31.0000000Z' in remove_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - remove_attr_check_actual.objects[0]['ansible-IntMulti'] | length == 4 - 0 in remove_attr_check_actual.objects[0]['ansible-IntMulti'] - 1 in remove_attr_check_actual.objects[0]['ansible-IntMulti'] - 2 in remove_attr_check_actual.objects[0]['ansible-IntMulti'] - 3 in remove_attr_check_actual.objects[0]['ansible-IntMulti'] - remove_attr_check_actual.objects[0]['ansible-SDMulti'] | length == 4 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in remove_attr_check_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)' in remove_attr_check_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC)' in remove_attr_check_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG)' in remove_attr_check_actual.objects[0]['ansible-SDMulti']" - remove_attr_check_actual.objects[0]['ansible-StringMulti'] | length == 4 - "'multi 1' in remove_attr_check_actual.objects[0]['ansible-StringMulti']" - "'multi 2' in remove_attr_check_actual.objects[0]['ansible-StringMulti']" - "'3' in remove_attr_check_actual.objects[0]['ansible-StringMulti']" - "'4' in remove_attr_check_actual.objects[0]['ansible-StringMulti']" - name: remove attribute object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: remove: ansible-BoolMulti: - type: bool value: '' # Will be false when casted ansible-BytesMulti: - type: bytes value: dGVzdA== - type: bytes value: Y2FmZQ== ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '2023-01-17T16:00:31+00:30' ansible-IntMulti: - type: int value: '2' - type: raw value: 3 ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG) ansible-StringMulti: - type: string value: 3 - type: raw value: '4' state: present register: remove_attr - name: get result of remove attribute object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolMulti - ansible-BytesMulti - ansible-DateTimeMulti - ansible-IntMulti - ansible-SDMulti - ansible-StringMulti register: remove_attr_actual - name: assert remove attribute assert: that: - remove_attr is changed - remove_attr_actual.objects[0]['ansible-BoolMulti'] == [True] - remove_attr_actual.objects[0]['ansible-BytesMulti'] | length == 2 - "'YmFy' in remove_attr_actual.objects[0]['ansible-BytesMulti']" - "'Zm9v' in remove_attr_actual.objects[0]['ansible-BytesMulti']" - remove_attr_actual.objects[0]['ansible-DateTimeMulti'] | length == 2 - "'1601-01-01T01:00:00.0000000Z' in remove_attr_actual.objects[0]['ansible-DateTimeMulti']" - "'1969-12-31T23:00:00.0000000Z' in remove_attr_actual.objects[0]['ansible-DateTimeMulti']" - remove_attr_actual.objects[0]['ansible-IntMulti'] | length == 2 - 0 in remove_attr_actual.objects[0]['ansible-IntMulti'] - 1 in remove_attr_actual.objects[0]['ansible-IntMulti'] - remove_attr_actual.objects[0]['ansible-SDMulti'] | length == 2 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in remove_attr_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)' in remove_attr_actual.objects[0]['ansible-SDMulti']" - remove_attr_actual.objects[0]['ansible-StringMulti'] | length == 2 - "'multi 1' in remove_attr_actual.objects[0]['ansible-StringMulti']" - "'multi 2' in remove_attr_actual.objects[0]['ansible-StringMulti']" - name: remove attribute - idempotent object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: remove: ansible-BoolMulti: - type: bool value: '' # Will be false when casted ansible-BytesMulti: - type: bytes value: dGVzdA== - type: bytes value: Y2FmZQ== ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '2023-01-17T16:00:31+00:30' ansible-IntMulti: - type: int value: '2' - type: raw value: 3 ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DG) ansible-StringMulti: - type: string value: 3 - type: raw value: '4' state: present register: remove_attr_again - name: assert remove attribute - idempotent assert: that: - not remove_attr_again is changed - name: set attribute - check object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: set: ansible-BoolSingle: true ansible-BoolMulti: false ansible-BytesSingle: type: bytes value: YmFy ansible-BytesMulti: - type: bytes value: dGVzdA== - type: bytes value: YmFy ansible-DateTimeSingle: type: date_time value: '1601-01-01T00:00:00Z' ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '1601-01-01T00:01:00.1-02:00' ansible-IntSingle: 1 ansible-IntMulti: - 0 - 3 ansible-SDSingle: type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU) ansible-StringSingle: Single ansible-StringMulti: - multi 1 - multi 3 state: present register: set_attr_check check_mode: true - name: get result of set attribute - check object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolSingle - ansible-BoolMulti - ansible-BytesSingle - ansible-BytesMulti - ansible-DateTimeSingle - ansible-DateTimeMulti - ansible-IntSingle - ansible-IntMulti - ansible-SDSingle - ansible-SDMulti - ansible-StringSingle - ansible-StringMulti register: set_attr_check_actual - name: assert set attribute - check assert: that: - set_attr_check is changed - set_attr_check_actual.objects[0]['ansible-BoolSingle'] == False - set_attr_check_actual.objects[0]['ansible-BoolMulti'] == [True] - set_attr_check_actual.objects[0]['ansible-BytesSingle'] == "Zm9v" - set_attr_check_actual.objects[0]['ansible-BytesMulti'] | length == 2 - "'YmFy' in set_attr_check_actual.objects[0]['ansible-BytesMulti']" - "'Zm9v' in set_attr_check_actual.objects[0]['ansible-BytesMulti']" - set_attr_check_actual.objects[0]['ansible-DateTimeSingle'] == "1970-01-01T00:00:00.0000000Z" - set_attr_check_actual.objects[0]['ansible-DateTimeMulti'] | length == 2 - "'1601-01-01T01:00:00.0000000Z' in set_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - "'1969-12-31T23:00:00.0000000Z' in set_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - set_attr_check_actual.objects[0]['ansible-IntSingle'] == 0 - set_attr_check_actual.objects[0]['ansible-IntMulti'] | length == 2 - 0 in set_attr_check_actual.objects[0]['ansible-IntMulti'] - 1 in set_attr_check_actual.objects[0]['ansible-IntMulti'] - set_attr_check_actual.objects[0]['ansible-SDSingle'] == "O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)" - set_attr_check_actual.objects[0]['ansible-SDMulti'] | length == 2 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in set_attr_check_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)' in set_attr_check_actual.objects[0]['ansible-SDMulti']" - set_attr_check_actual.objects[0]['ansible-StringSingle'] == "single" - set_attr_check_actual.objects[0]['ansible-StringMulti'] | length == 2 - "'multi 1' in set_attr_check_actual.objects[0]['ansible-StringMulti']" - "'multi 2' in set_attr_check_actual.objects[0]['ansible-StringMulti']" - name: set attribute object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: set: ansible-BoolSingle: true ansible-BoolMulti: false ansible-BytesSingle: type: bytes value: YmFy ansible-BytesMulti: - type: bytes value: dGVzdA== - type: bytes value: YmFy ansible-DateTimeSingle: type: date_time value: '1601-01-01T00:00:00Z' ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '1601-01-01T00:01:00.0-02:00' ansible-IntSingle: 1 ansible-IntMulti: - 0 - 3 ansible-SDSingle: type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU) ansible-StringSingle: Single ansible-StringMulti: - multi 1 - multi 3 state: present register: set_attr - name: get result of set attribute object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolSingle - ansible-BoolMulti - ansible-BytesSingle - ansible-BytesMulti - ansible-DateTimeSingle - ansible-DateTimeMulti - ansible-IntSingle - ansible-IntMulti - ansible-SDSingle - ansible-SDMulti - ansible-StringSingle - ansible-StringMulti register: set_attr_actual - name: assert set attribute assert: that: - set_attr is changed - set_attr_actual.objects[0]['ansible-BoolSingle'] == True - set_attr_actual.objects[0]['ansible-BoolMulti'] == [False] - set_attr_actual.objects[0]['ansible-BytesSingle'] == "YmFy" - set_attr_actual.objects[0]['ansible-BytesMulti'] | length == 2 - "'YmFy' in set_attr_actual.objects[0]['ansible-BytesMulti']" - "'dGVzdA==' in set_attr_actual.objects[0]['ansible-BytesMulti']" - set_attr_actual.objects[0]['ansible-DateTimeSingle'] == "1601-01-01T00:00:00.0000000Z" - set_attr_actual.objects[0]['ansible-DateTimeMulti'] | length == 2 - "'1601-01-01T02:01:00.0000000Z' in set_attr_actual.objects[0]['ansible-DateTimeMulti']" - "'1970-01-01T00:00:00.0000000Z' in set_attr_actual.objects[0]['ansible-DateTimeMulti']" - set_attr_actual.objects[0]['ansible-IntSingle'] == 1 - set_attr_actual.objects[0]['ansible-IntMulti'] | length == 2 - 0 in set_attr_actual.objects[0]['ansible-IntMulti'] - 3 in set_attr_actual.objects[0]['ansible-IntMulti'] - set_attr_actual.objects[0]['ansible-SDSingle'] == "O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)" - set_attr_actual.objects[0]['ansible-SDMulti'] | length == 2 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in set_attr_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC)' in set_attr_actual.objects[0]['ansible-SDMulti']" - set_attr_actual.objects[0]['ansible-StringSingle'] == "Single" - set_attr_actual.objects[0]['ansible-StringMulti'] | length == 2 - "'multi 1' in set_attr_actual.objects[0]['ansible-StringMulti']" - "'multi 3' in set_attr_actual.objects[0]['ansible-StringMulti']" - name: set attribute - idempotent object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: set: ansible-BoolSingle: true ansible-BoolMulti: false ansible-BytesSingle: type: bytes value: YmFy ansible-BytesMulti: - type: bytes value: dGVzdA== - type: bytes value: YmFy ansible-DateTimeSingle: type: date_time value: '1601-01-01T00:00:00Z' ansible-DateTimeMulti: - type: date_time value: '1970-01-01T00:00:00' - type: date_time value: '1601-01-01T00:01:00.0-02:00' ansible-IntSingle: 1 ansible-IntMulti: - 0 - 3 ansible-SDSingle: type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN) ansible-SDMulti: - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC) - type: security_descriptor value: O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU) ansible-StringSingle: Single ansible-StringMulti: - multi 1 - multi 3 state: present register: set_attr_again - name: assert set attribute - idempotent assert: that: - not set_attr_again is changed - name: clear attribute - check object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: set: ansible-BoolSingle: ansible-BoolMulti: ansible-BytesSingle: [] ansible-BytesMulti: [] ansible-DateTimeSingle: ~ ansible-DateTimeMulti: ~ ansible-IntSingle: ansible-IntMulti: ansible-SDSingle: ansible-SDMulti: ansible-StringSingle: ansible-StringMulti: state: present register: clear_attr_check check_mode: true - name: get result of clear attribute - check object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolSingle - ansible-BoolMulti - ansible-BytesSingle - ansible-BytesMulti - ansible-DateTimeSingle - ansible-DateTimeMulti - ansible-IntSingle - ansible-IntMulti - ansible-SDSingle - ansible-SDMulti - ansible-StringSingle - ansible-StringMulti register: clear_attr_check_actual - name: assert clear attribute - check assert: that: - clear_attr_check is changed - clear_attr_check_actual.objects[0]['ansible-BoolSingle'] == True - clear_attr_check_actual.objects[0]['ansible-BoolMulti'] == [False] - clear_attr_check_actual.objects[0]['ansible-BytesSingle'] == "YmFy" - clear_attr_check_actual.objects[0]['ansible-BytesMulti'] | length == 2 - "'YmFy' in clear_attr_check_actual.objects[0]['ansible-BytesMulti']" - "'dGVzdA==' in clear_attr_check_actual.objects[0]['ansible-BytesMulti']" - clear_attr_check_actual.objects[0]['ansible-DateTimeSingle'] == "1601-01-01T00:00:00.0000000Z" - clear_attr_check_actual.objects[0]['ansible-DateTimeMulti'] | length == 2 - "'1601-01-01T02:01:00.0000000Z' in clear_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - "'1970-01-01T00:00:00.0000000Z' in clear_attr_check_actual.objects[0]['ansible-DateTimeMulti']" - clear_attr_check_actual.objects[0]['ansible-IntSingle'] == 1 - clear_attr_check_actual.objects[0]['ansible-IntMulti'] | length == 2 - 0 in clear_attr_check_actual.objects[0]['ansible-IntMulti'] - 3 in clear_attr_check_actual.objects[0]['ansible-IntMulti'] - clear_attr_check_actual.objects[0]['ansible-SDSingle'] == "O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AN)" - clear_attr_check_actual.objects[0]['ansible-SDMulti'] | length == 2 - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)' in clear_attr_check_actual.objects[0]['ansible-SDMulti']" - "'O:DAG:DAD:PAI(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;DC)' in clear_attr_check_actual.objects[0]['ansible-SDMulti']" - clear_attr_check_actual.objects[0]['ansible-StringSingle'] == "Single" - clear_attr_check_actual.objects[0]['ansible-StringMulti'] | length == 2 - "'multi 1' in clear_attr_check_actual.objects[0]['ansible-StringMulti']" - "'multi 3' in clear_attr_check_actual.objects[0]['ansible-StringMulti']" - name: clear attribute object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: set: ansible-BoolSingle: ansible-BoolMulti: ansible-BytesSingle: [] ansible-BytesMulti: [] ansible-DateTimeSingle: ~ ansible-DateTimeMulti: ~ ansible-IntSingle: ansible-IntMulti: ansible-SDSingle: ansible-SDMulti: ansible-StringSingle: ansible-StringMulti: state: present register: clear_attr - name: get result of clear attribute object_info: identity: '{{ sub_object.object_guid }}' properties: - ansible-BoolSingle - ansible-BoolMulti - ansible-BytesSingle - ansible-BytesMulti - ansible-DateTimeSingle - ansible-DateTimeMulti - ansible-IntSingle - ansible-IntMulti - ansible-SDSingle - ansible-SDMulti - ansible-StringSingle - ansible-StringMulti register: clear_attr_actual - name: assert clear attribute assert: that: - clear_attr is changed - clear_attr_actual.objects[0]['ansible-BoolSingle'] == None - clear_attr_actual.objects[0]['ansible-BoolMulti'] == None - clear_attr_actual.objects[0]['ansible-BytesSingle'] == None - clear_attr_actual.objects[0]['ansible-BytesMulti'] == None - clear_attr_actual.objects[0]['ansible-DateTimeSingle'] == None - clear_attr_actual.objects[0]['ansible-DateTimeMulti'] == None - clear_attr_actual.objects[0]['ansible-IntSingle'] == None - clear_attr_actual.objects[0]['ansible-IntMulti'] == None - clear_attr_actual.objects[0]['ansible-SDSingle'] == None - clear_attr_actual.objects[0]['ansible-SDMulti'] == None - clear_attr_actual.objects[0]['ansible-StringSingle'] == None - clear_attr_actual.objects[0]['ansible-StringMulti'] == None - name: clear attribute - idempotent object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact attributes: set: ansible-BoolSingle: ansible-BoolMulti: ansible-BytesSingle: [] ansible-BytesMulti: [] ansible-DateTimeSingle: ~ ansible-DateTimeMulti: ~ ansible-IntSingle: ansible-IntMulti: ansible-SDSingle: ansible-SDMulti: ansible-StringSingle: ansible-StringMulti: state: present register: clear_attr_again - name: assert clear attribute - idempotent assert: that: - not clear_attr_again is changed - name: unset display and description object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact display_name: '' description: '' register: unset_normal - name: get result of unset display and description object_info: identity: '{{ sub_object.object_guid }}' properties: - DisplayName - Description register: unset_normal_actual - name: assert unset display and description assert: that: - unset_normal is changed - unset_normal_actual.objects[0].DisplayName == None - unset_normal_actual.objects[0].Description == None - name: unset display and description - idempotent object: name: Contact path: CN=My\, Container,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }} type: contact display_name: '' description: '' register: unset_normal_again - name: assert unset display and description - idempotent assert: that: - not unset_normal_again is changed - name: move object back into the default path - check object: name: My, Container identity: '{{ object_identity }}' type: container path: microsoft.ad.default_path register: move_into_default_check check_mode: true - name: get result of move object back into the default path - check object_info: identity: '{{ object_identity }}' register: move_into_default_check_actual - name: assert move object back into the default path - check assert: that: - move_into_default_check is changed - move_into_default_check.distinguished_name == 'CN=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - move_into_default_check_actual.objects[0].DistinguishedName == 'CN=My\, Container,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext - name: move object back into the default path object: name: My, Container identity: '{{ object_identity }}' type: container path: microsoft.ad.default_path register: move_into_default - name: get result of move object back into the default path object_info: identity: '{{ object_identity }}' register: move_into_default_actual - name: assert move object back into the default path assert: that: - move_into_default is changed - move_into_default.distinguished_name == 'CN=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - move_into_default_actual.objects[0].DistinguishedName == 'CN=My\, Container,' ~ setup_domain_info.output[0].defaultNamingContext - name: move object back into the default path - idempotent object: name: My, Container identity: '{{ object_identity }}' type: container path: microsoft.ad.default_path register: move_into_default_again - name: assert move object back into the default path - idempotent assert: that: - not move_into_default_again is changed