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

vmware_local_user_manager - shell access #1790

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions plugins/modules/vmware_local_user_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
- Description for the user.
required: false
type: str
local_user_shell_access:
description:
- Defined if user grants shell access.
required: false
default: true
type: bool
state:
description:
- Indicate desired state of the user. If the user already exists when C(state=present), the user info is updated
Expand All @@ -55,6 +61,7 @@
password: vmware
local_user_name: foo
local_user_password: password
local_user_shell_access: true
delegate_to: localhost
'''

Expand All @@ -76,6 +83,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():
Expand Down Expand Up @@ -125,6 +133,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):
Expand Down Expand Up @@ -167,6 +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', default=True),
state=dict(default='present', choices=['present', 'absent'], type='str')))

module = AnsibleModule(argument_spec=argument_spec,
Expand Down