{{ cat }}'s docs

1.6.2: LOGIC-service_facts

1. service_facts用法

基础用法

---
- name: populate service facts
  service_facts:

- debug:
    var: ansible_facts.services

查看指定服务的运行状态方法

- name: populate service facts
  service_facts:

- debug:
    var: ansible_facts.services['\{\{item}}.service']
  with_items: "\{\{ ['php-fpm', 'mysql', 'nginx'] }}"
  ignore_errors: yes

ansible 2.5 及其更新版本可用

Contents