1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add systemctl daemon-reexec to systemd module

```
- name: systemctl daemon-reexec
  - systemd:
       daemon_reexec=yes
```

Closes: #38880

Signed-off-by: Susant Sahani <susant@redhat.com>
This commit is contained in:
Susant Sahani 2018-09-22 11:43:33 +05:30 committed by Brian Coca
parent 172137c3ca
commit 8ef18839a6

View file

@ -48,6 +48,13 @@ options:
type: bool
default: 'no'
aliases: [ daemon-reload ]
daemon_reexec:
description:
- run daemon_reexec command before doing any other operations, the systemd manager will serialize the manager state.
type: bool
default: 'no'
aliases: [ daemon-reexec ]
version_added: "2.8"
user:
description:
- (deprecated) run ``systemctl`` talking to the service manager of the calling user, rather than the service manager
@ -306,6 +313,7 @@ def main():
force=dict(type='bool'),
masked=dict(type='bool'),
daemon_reload=dict(type='bool', default=False, aliases=['daemon-reload']),
daemon_reexec=dict(type='bool', default=False, aliases=['daemon-reexec']),
user=dict(type='bool'),
scope=dict(type='str', choices=['system', 'user', 'global']),
no_block=dict(type='bool', default=False),
@ -356,6 +364,12 @@ def main():
if rc != 0:
module.fail_json(msg='failure %d during daemon-reload: %s' % (rc, err))
# Run daemon-reexec
if module.params['daemon_reexec'] and not module.check_mode:
(rc, out, err) = module.run_command("%s daemon-reexec" % (systemctl))
if rc != 0:
module.fail_json(msg='failure %d during daemon-reexec: %s' % (rc, err))
if unit:
found = False
is_initd = sysv_exists(unit)