Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 'description' to azure_rm_adgroup #1492

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion plugins/modules/azure_rm_adgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
- The azure ad objects asserted to not be owners of the group.
type: list
elements: str
description:
description:
- An optional description for the group.
type: str
extends_documentation_fragment:
- azure.azcollection.azure
author:
Expand All @@ -74,6 +78,7 @@
azure_rm_adgroup:
display_name: "Group-Name"
mail_nickname: "Group-Mail-Nickname"
description: 'fortest'
state: 'present'

- name: Delete Group using display_name and mail_nickname
Expand Down Expand Up @@ -201,6 +206,12 @@
- The members of the group.
returned: always
type: list
description:
description:
- An optional description for the group.
type: str
returned: always
sample: 'fortest'
'''

from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_ext import AzureRMModuleBase
Expand Down Expand Up @@ -228,6 +239,7 @@ def __init__(self):
present_owners=dict(type='list', elements='str'),
absent_members=dict(type='list', elements='str'),
absent_owners=dict(type='list', elements='str'),
description=dict(type='str'),
state=dict(
type='str',
default='present',
Expand Down Expand Up @@ -287,6 +299,7 @@ def exec_module(self, **kwargs):
group_types=[],
display_name=self.display_name,
mail_nickname=self.mail_nickname,
description=self.description
)

ad_groups = [asyncio.get_event_loop().run_until_complete(self.create_group(group))]
Expand Down Expand Up @@ -390,7 +403,8 @@ def group_to_dict(self, object):
mail_nickname=object.mail_nickname,
mail_enabled=object.mail_enabled,
security_enabled=object.security_enabled,
mail=object.mail
mail=object.mail,
description=object.description
)

def user_to_dict(self, object):
Expand Down
9 changes: 8 additions & 1 deletion plugins/modules/azure_rm_adgroup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@
- The members of the group.
returned: always
type: list
description:
description:
- An optional description for the group.
type: str
returned: always
sample: 'fortest'
'''

from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_ext import AzureRMModuleBase
Expand Down Expand Up @@ -259,7 +265,8 @@ def group_to_dict(self, object):
mail_nickname=object.mail_nickname,
mail_enabled=object.mail_enabled,
security_enabled=object.security_enabled,
mail=object.mail
mail=object.mail,
description=object.description
)

def user_to_dict(self, object):
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/targets/azure_rm_adgroup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
azure_rm_adgroup:
display_name: "{{ resource_prefix }}-Group-Root"
mail_nickname: "{{ resource_prefix }}-Group-Root"
description: 'for test'
state: 'present'
register: group_create_changed_shouldpass

- name: Create Group Should Return Not Changed
azure_rm_adgroup:
display_name: "{{ resource_prefix }}-Group-Root"
mail_nickname: "{{ resource_prefix }}-Group-Root"
description: 'for test'
state: 'present'
register: group_create_unchanged_shouldpass

Expand All @@ -45,6 +47,7 @@
ansible.builtin.assert:
that:
- get_created_object_id_shouldpass.ad_groups[0].object_id == group_create_unchanged_shouldpass.object_id
- get_created_object_id_shouldpass.ad_groups[0].description == 'for test'

- name: Create Group Member 1
azure_rm_adgroup:
Expand Down