Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
[pritunl] add mac_addresses parameter (ansible-collections#4535)
Browse files Browse the repository at this point in the history
* 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
vvatlin and felixfontein authored May 9, 2022
1 parent 9e1af2d commit cf55ef8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
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).
21 changes: 16 additions & 5 deletions plugins/modules/net_tools/pritunl/pritunl_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down Expand Up @@ -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"),
}

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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),
)
),

Expand Down

0 comments on commit cf55ef8

Please sign in to comment.