|
|
|
@ -81,6 +81,14 @@ options:
|
|
|
|
|
type: bool
|
|
|
|
|
default: no
|
|
|
|
|
version_added: "2.3"
|
|
|
|
|
machine:
|
|
|
|
|
description:
|
|
|
|
|
- Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating `@` character.
|
|
|
|
|
- If the special string `.host` is used in place of the container name, a connection to the local system is made.
|
|
|
|
|
- If the `@` syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case
|
|
|
|
|
the local user name and `.host` are implied.
|
|
|
|
|
type: str
|
|
|
|
|
version_added: "2.17"
|
|
|
|
|
extends_documentation_fragment: action_common_attributes
|
|
|
|
|
attributes:
|
|
|
|
|
check_mode:
|
|
|
|
@ -149,6 +157,13 @@ EXAMPLES = '''
|
|
|
|
|
scope: user
|
|
|
|
|
environment:
|
|
|
|
|
XDG_RUNTIME_DIR: "/run/user/{{ myuid }}"
|
|
|
|
|
|
|
|
|
|
- name: Run from within a specific user session
|
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
|
name: myservice
|
|
|
|
|
state: started
|
|
|
|
|
scope: user
|
|
|
|
|
machine: myuser@.host
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
@ -352,6 +367,7 @@ def main():
|
|
|
|
|
daemon_reexec=dict(type='bool', default=False, aliases=['daemon-reexec']),
|
|
|
|
|
scope=dict(type='str', default='system', choices=['system', 'user', 'global']),
|
|
|
|
|
no_block=dict(type='bool', default=False),
|
|
|
|
|
machine=dict(type='str'),
|
|
|
|
|
),
|
|
|
|
|
supports_check_mode=True,
|
|
|
|
|
required_one_of=[['state', 'enabled', 'masked', 'daemon_reload', 'daemon_reexec']],
|
|
|
|
@ -379,6 +395,9 @@ def main():
|
|
|
|
|
if module.params['scope'] != 'system':
|
|
|
|
|
systemctl += " --%s" % module.params['scope']
|
|
|
|
|
|
|
|
|
|
if module.params['machine']:
|
|
|
|
|
systemctl += " --machine=%s" % module.params['machine']
|
|
|
|
|
|
|
|
|
|
if module.params['no_block']:
|
|
|
|
|
systemctl += " --no-block"
|
|
|
|
|
|
|
|
|
|