systemd doc update (#74442)

Document that systemd module manages units (timers, services, ...) and not only service. (#74442)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
This commit is contained in:
Baptiste Mille-Mathias 2021-05-06 06:19:42 +02:00 committed by GitHub
parent dcb807dea7
commit 74647a1314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,25 +13,26 @@ module: systemd
author: author:
- Ansible Core Team - Ansible Core Team
version_added: "2.2" version_added: "2.2"
short_description: Manage services short_description: Manage systemd units
description: description:
- Controls systemd services on remote hosts. - Controls systemd units (services, timers, and so on) on remote hosts.
options: options:
name: name:
description: description:
- Name of the service. This parameter takes the name of exactly one service to work with. - Name of the unit. This parameter takes the name of exactly one unit to work with.
- When using in a chroot environment you always need to specify the full name i.e. (crond.service). - When no extension is given, it is implied to a C(.service) as systemd.
- When using in a chroot environment you always need to specify the name of the unit with the extension. For example, C(crond.service).
type: str type: str
aliases: [ service, unit ] aliases: [ service, unit ]
state: state:
description: description:
- C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. - C(started)/C(stopped) are idempotent actions that will not run commands unless necessary.
C(restarted) will always bounce the service. C(reloaded) will always reload. C(restarted) will always bounce the unit. C(reloaded) will always reload.
type: str type: str
choices: [ reloaded, restarted, started, stopped ] choices: [ reloaded, restarted, started, stopped ]
enabled: enabled:
description: description:
- Whether the service should start on boot. B(At least one of state and enabled are required.) - Whether the unit should start on boot. B(At least one of state and enabled are required.)
type: bool type: bool
force: force:
description: description:
@ -45,7 +46,7 @@ options:
daemon_reload: daemon_reload:
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.
- When set to C(yes), runs daemon-reload even if the module does not start or stop anything. - When set to C(true), runs daemon-reload even if the module does not start or stop anything.
type: bool type: bool
default: no default: no
aliases: [ daemon-reload ] aliases: [ daemon-reload ]
@ -77,9 +78,9 @@ options:
default: no default: no
version_added: "2.3" version_added: "2.3"
notes: notes:
- Since 2.4, one of the following options is required 'state', 'enabled', 'masked', 'daemon_reload', ('daemon_reexec' since 2.8), - Since 2.4, one of the following options is required C(state), C(enabled), C(masked), C(daemon_reload), (C(daemon_reexec) since 2.8),
and all except 'daemon_reload' (and 'daemon_reexec' since 2.8) also require 'name'. and all except C(daemon_reload) and (C(daemon_reexec) since 2.8) also require C(name).
- Before 2.4 you always required 'name'. - Before 2.4 you always required C(name).
- Globs are not supported in name, i.e ``postgres*.service``. - Globs are not supported in name, i.e ``postgres*.service``.
- Supports C(check_mode). - Supports C(check_mode).
requirements: requirements:
@ -87,7 +88,7 @@ requirements:
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: Make sure a service is running - name: Make sure a service unit is running
ansible.builtin.systemd: ansible.builtin.systemd:
state: started state: started
name: httpd name: httpd
@ -105,7 +106,7 @@ EXAMPLES = '''
- name: Reload service httpd, in all cases - name: Reload service httpd, in all cases
ansible.builtin.systemd: ansible.builtin.systemd:
name: httpd name: httpd.service
state: reloaded state: reloaded
- name: Enable service httpd and ensure it is not masked - name: Enable service httpd and ensure it is not masked
@ -114,7 +115,7 @@ EXAMPLES = '''
enabled: yes enabled: yes
masked: no masked: no
- name: Enable a timer for dnf-automatic - name: Enable a timer unit for dnf-automatic
ansible.builtin.systemd: ansible.builtin.systemd:
name: dnf-automatic.timer name: dnf-automatic.timer
state: started state: started