From bae76f181a3ba664f8cc1d3d177c07793e14c16f Mon Sep 17 00:00:00 2001 From: cbreuil-orange <131947205+cbreuil-orange@users.noreply.github.com> Date: Wed, 12 Jul 2023 14:06:13 +0200 Subject: [PATCH 1/3] add shellAccess propriety --- plugins/modules/vmware_local_user_manager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/modules/vmware_local_user_manager.py b/plugins/modules/vmware_local_user_manager.py index 3a95ae2d2..a40323cd9 100644 --- a/plugins/modules/vmware_local_user_manager.py +++ b/plugins/modules/vmware_local_user_manager.py @@ -36,6 +36,11 @@ - Description for the user. required: false type: str + local_user_shell_access: + description: + - Defined if user grants shell access. + required: false + type: bool state: description: - Indicate desired state of the user. If the user already exists when C(state=present), the user info is updated @@ -55,6 +60,7 @@ password: vmware local_user_name: foo local_user_password: password + local_user_shell_access: true delegate_to: localhost ''' @@ -76,6 +82,7 @@ def __init__(self, module): self.local_user_name = self.module.params['local_user_name'] self.local_user_password = self.module.params['local_user_password'] self.local_user_description = self.module.params['local_user_description'] + self.local_user_shell_access = self.module.params['local_user_shell_access'] self.state = self.module.params['state'] if self.is_vcenter(): @@ -125,6 +132,7 @@ def create_account_spec(self): account_spec.id = self.local_user_name account_spec.password = self.local_user_password account_spec.description = self.local_user_description + account_spec.shellAccess = self.local_user_shell_access return account_spec def state_create_user(self): @@ -167,6 +175,7 @@ def main(): argument_spec.update(dict(local_user_name=dict(required=True, type='str'), local_user_password=dict(type='str', no_log=True), local_user_description=dict(type='str'), + local_user_shell_access=dict(type='bool'), state=dict(default='present', choices=['present', 'absent'], type='str'))) module = AnsibleModule(argument_spec=argument_spec, From e7c855e01e4983054655df38fb7a7e4c210d9e71 Mon Sep 17 00:00:00 2001 From: cbreuil-orange <131947205+cbreuil-orange@users.noreply.github.com> Date: Wed, 12 Jul 2023 14:12:04 +0200 Subject: [PATCH 2/3] default value for shellAccess --- plugins/modules/vmware_local_user_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/vmware_local_user_manager.py b/plugins/modules/vmware_local_user_manager.py index a40323cd9..e6139d857 100644 --- a/plugins/modules/vmware_local_user_manager.py +++ b/plugins/modules/vmware_local_user_manager.py @@ -40,6 +40,7 @@ description: - Defined if user grants shell access. required: false + default: true type: bool state: description: @@ -175,7 +176,7 @@ def main(): argument_spec.update(dict(local_user_name=dict(required=True, type='str'), local_user_password=dict(type='str', no_log=True), local_user_description=dict(type='str'), - local_user_shell_access=dict(type='bool'), + local_user_shell_access=dict(type='bool', default=True), state=dict(default='present', choices=['present', 'absent'], type='str'))) module = AnsibleModule(argument_spec=argument_spec, From 8f5f6073fbe602226db2ae54f619a3b96827c2fd Mon Sep 17 00:00:00 2001 From: cbreuil-orange <131947205+cbreuil-orange@users.noreply.github.com> Date: Thu, 13 Jul 2023 08:44:55 +0200 Subject: [PATCH 3/3] lint --- plugins/modules/vmware_local_user_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/vmware_local_user_manager.py b/plugins/modules/vmware_local_user_manager.py index e6139d857..efe5f14e8 100644 --- a/plugins/modules/vmware_local_user_manager.py +++ b/plugins/modules/vmware_local_user_manager.py @@ -41,7 +41,7 @@ - Defined if user grants shell access. required: false default: true - type: bool + type: bool state: description: - Indicate desired state of the user. If the user already exists when C(state=present), the user info is updated