ansible / ansible.builtin / v2.9.27 / module / service_facts Return service state information as fact data | "added in version" 2.5 of ansible.builtin" Authors: Adam Miller (@maxamillion) preview | supported by communityansible.builtin.service_facts (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Return service state information as fact data for various service management utilities
- name: Populate service facts service_facts:
- debug: var: ansible_facts.services
ansible_facts: contains: services: contains: name: description: Name of the service. returned: always sample: arp-ethers.service type: str source: description: Init system of the service. One of C(systemd), C(sysv), C(upstart). returned: always sample: sysv type: str state: description: State of the service. Either C(running), C(stopped), or C(unknown). returned: always sample: running type: str status: description: State of the service. Either C(enabled), C(disabled), or C(unknown). returned: systemd systems or RedHat/SUSE flavored sysvinit/upstart sample: enabled type: str description: States of the services with service name as key. returned: always type: complex description: Facts to add to ansible_facts about the services on the system returned: always type: complex