This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
forked from ansible-collections/community.general
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pritunl] add mac_addresses parameter (ansible-collections#4535)
* add mac_addresses parameter * add changelog * remove debug line * add second blank line * add mac_addresses comparision * Update changelogs/fragments/4535-pritunl-add-mac_addresses-parameter.yml Co-authored-by: Felix Fontein <[email protected]> * Update plugins/modules/net_tools/pritunl/pritunl_user.py Co-authored-by: Felix Fontein <[email protected]> * Update plugins/modules/net_tools/pritunl/pritunl_user.py Co-authored-by: Felix Fontein <[email protected]> * Update plugins/modules/net_tools/pritunl/pritunl_user.py Co-authored-by: Felix Fontein <[email protected]> * Update plugins/modules/net_tools/pritunl/pritunl_user.py Co-authored-by: Felix Fontein <[email protected]> Co-authored-by: vadim <vadim> Co-authored-by: Felix Fontein <[email protected]>
- Loading branch information
1 parent
9e1af2d
commit cf55ef8
Showing
2 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
changelogs/fragments/4535-pritunl-add-mac_addresses-parameter.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
minor_changes: | ||
- pritunl_user - add ``mac_addresses`` parameter (https://github.com/ansible-collections/community.general/pull/4535). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,28 +82,37 @@ | |
default: null | ||
description: | ||
- Enable/Disable Gravatar usage for the user I(user_name). | ||
user_mac_addresses: | ||
type: list | ||
elements: str | ||
description: | ||
- Allowed MAC addresses for the user I(user_name). | ||
version_added: 5.0.0 | ||
""" | ||
|
||
EXAMPLES = """ | ||
- name: Create the user Foo with email address [email protected] in MyOrg | ||
community.general.pritunl_user: | ||
state: present | ||
name: MyOrg | ||
organization: MyOrg | ||
user_name: Foo | ||
user_email: [email protected] | ||
user_mac_addresses: | ||
- "00:00:00:00:00:99" | ||
- name: Disable the user Foo but keep it in Pritunl | ||
community.general.pritunl_user: | ||
state: present | ||
name: MyOrg | ||
organization: MyOrg | ||
user_name: Foo | ||
user_email: [email protected] | ||
user_disabled: yes | ||
- name: Make sure the user Foo is not part of MyOrg anymore | ||
community.general.pritunl_user: | ||
state: absent | ||
name: MyOrg | ||
organization: MyOrg | ||
user_name: Foo | ||
""" | ||
|
||
|
@@ -167,6 +176,7 @@ def add_or_update_pritunl_user(module): | |
"groups": module.params.get("user_groups"), | ||
"disabled": module.params.get("user_disabled"), | ||
"gravatar": module.params.get("user_gravatar"), | ||
"mac_addresses": module.params.get("user_mac_addresses"), | ||
"type": module.params.get("user_type"), | ||
} | ||
|
||
|
@@ -204,8 +214,8 @@ def add_or_update_pritunl_user(module): | |
if user_params[key] is None: | ||
user_params[key] = users[0][key] | ||
|
||
# 'groups' is a list comparison | ||
if key == "groups": | ||
# 'groups' and 'mac_addresses' are list comparison | ||
if key == "groups" or key == "mac_addresses": | ||
if set(users[0][key]) != set(user_params[key]): | ||
user_params_changed = True | ||
|
||
|
@@ -323,6 +333,7 @@ def main(): | |
user_groups=dict(required=False, type="list", elements="str", default=None), | ||
user_disabled=dict(required=False, type="bool", default=None), | ||
user_gravatar=dict(required=False, type="bool", default=None), | ||
user_mac_addresses=dict(required=False, type="list", elements="str", default=None), | ||
) | ||
), | ||
|
||
|