system/systemd: enable systemctl --user (#4208)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-09-12 17:08:27 +02:00 committed by Matt Clay
parent 289e5f1884
commit b9962d2389

View file

@ -57,6 +57,13 @@ options:
description: description:
- run daemon-reload before doing any other operations, to make sure systemd has read any changes. - run daemon-reload before doing any other operations, to make sure systemd has read any changes.
aliases: ['daemon-reload'] 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: notes:
- One option other than name is required. - One option other than name is required.
requirements: requirements:
@ -231,6 +238,7 @@ def main():
enabled = dict(type='bool'), enabled = dict(type='bool'),
masked = dict(type='bool'), masked = dict(type='bool'),
daemon_reload= dict(type='bool', default=False, aliases=['daemon-reload']), daemon_reload= dict(type='bool', default=False, aliases=['daemon-reload']),
user= dict(type='bool', default=False),
), ),
supports_check_mode=True, supports_check_mode=True,
required_one_of=[['state', 'enabled', 'masked', 'daemon_reload']], required_one_of=[['state', 'enabled', 'masked', 'daemon_reload']],
@ -238,6 +246,8 @@ def main():
# initialize # initialize
systemctl = module.get_bin_path('systemctl') systemctl = module.get_bin_path('systemctl')
if module.params['user']:
systemctl = systemctl + " --user"
unit = module.params['name'] unit = module.params['name']
rc = 0 rc = 0
out = err = '' out = err = ''