service_facts - Return service state information as fact data¶
New in version 2.5.
Synopsis¶
- Return service state information as fact data for various service management utilities
Requirements¶
The below requirements are needed on the host that executes this module.
- Any of the following supported init systems: systemd, sysv, upstart
Notes¶
Note
- When accessing the
ansible_facts.servicesfacts collected by this module, it is recommended to not use “dot notation” because services can have a-character in their name which would result in invalid “dot notation”, such asansible_facts.services.zuul-gateway. It is instead recommended to using the string value of the service name as the key in order to obtain the fact data value likeansible_facts.services['zuul-gateway']
Returned Facts¶
Facts returned by this module are added/updated in the hostvars host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
| Fact | Returned | Description | |
|---|---|---|---|
|
services
complex
|
always |
States of the services with service name as key.
|
|
|
source
string
|
always |
Init system of the service. One of
systemd, sysv, upstart.
Sample:
sysv
|
|
|
state
string
|
always |
State of the service. Either
running or stopped.
Sample:
running
|
|
|
name
string
|
always |
Name of the service.
Sample:
arp-ethers.service
|
|
Status¶
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance¶
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author¶
- Matthew Jones
- Adam Miller (@maxamillion)
Hint
If you notice any issues in this documentation you can edit this document to improve it.