systemd
systemd module
Manage systemd services. This module can start, stop, enable, disable services and reload the systemd daemon configuration.
Examples
- name: Start and enable nginx
systemd:
name: nginx
state: started
enabled: true
- name: Stop a service
systemd:
name: apache2
state: stopped
- name: Reload systemd daemon
systemd:
daemon_reload: true
- name: Enable service without starting
systemd:
name: postgresql
enabled: true
Note: This module requires systemd to be the init system on the target host.
Module Capabilities
- Has Revert: true
- Provides Variables: None
Inputs
Parameter | Type | Description | Required | Default | Choices |
---|---|---|---|---|---|
daemon_reload | bool | Reload systemd daemon configuration before managing the service. | false | false | true, false |
enabled | bool | Whether the service should be enabled to start at boot. | false | true, false | |
name | string | Name of the systemd service to manage. | true | ||
state | string | Desired state of the service. | true | started, stopped, restarted, reloaded |
Outputs
No outputs.