Skip to content

Commit

Permalink
system/systemd: enable systemctl --user (ansible#4208)
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Murdaca <[email protected]>
  • Loading branch information
runcom authored and mattclay committed Dec 8, 2016
1 parent 289e5f1 commit b9962d2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ansible/modules/system/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
description:
- run daemon-reload before doing any other operations, to make sure systemd has read any changes.
aliases: ['daemon-reload']
user:
required: false
default: no
choices: [ "yes", "no" ]
description:
- run systemctl talking to the service manager of the calling user, rather than the service manager
of the system.
notes:
- One option other than name is required.
requirements:
Expand Down Expand Up @@ -231,13 +238,16 @@ def main():
enabled = dict(type='bool'),
masked = dict(type='bool'),
daemon_reload= dict(type='bool', default=False, aliases=['daemon-reload']),
user= dict(type='bool', default=False),
),
supports_check_mode=True,
required_one_of=[['state', 'enabled', 'masked', 'daemon_reload']],
)

# initialize
systemctl = module.get_bin_path('systemctl')
if module.params['user']:
systemctl = systemctl + " --user"
unit = module.params['name']
rc = 0
out = err = ''
Expand Down

0 comments on commit b9962d2

Please sign in to comment.