Check if service exists with Ansible

后端 未结 6 963
面向向阳花
面向向阳花 2020-12-14 14:12

I have an Ansible playbook for deploying a Java app as an init.d daemon.

Being a beginner in both Ansible and Linux I\'m having trouble to conditionally execute task

6条回答
  •  我在风中等你
    2020-12-14 14:42

    See the service_facts module, new in Ansible 2.5.

    - name: Populate service facts
      service_facts:
    - debug:
        msg: Docker installed!
      when: "'docker' in services"
    

提交回复
热议问题