Service
Handle packages on Debian-based distributions (Debian, Ubuntu, Linux Mint, Kali, Raspberry Pi OS...)
Parameters
Parameter | Type | Value | Description |
---|---|---|---|
name | String | <service-name> | Name of the service to handle |
state | String | started|stopped | Expected state of the service |
enabled | Bool | true|false | Is the service expected to be enabled ? |
Examples
---
- name: Handle services on the host
steps:
- name: Start a service
with_sudo: true
service:
name: apache2
state: started
- name: Stop a service
with_sudo: true
service:
name: apache2
state: started
- name: Start and enable a service
with_sudo: true
service:
name: apache2
state: started
enabled: true
- name: Disable a service (without stopping it)
with_sudo: true
service:
name: apache2
enabled: false