首页 > 解决方案 > 是否可以使用 Ansible 使用 start init.d 服务?

问题描述

Ansible 将失败以下任务

- name: Start opendj
  service: name={{opendj_service_name}} state=started enabled=yes

因为该服务是 init.d 服务而不是 systemd

是否可以使用 Ansible 启动 init.d 服务?

标签: ansiblesystemdinit.d

解决方案


你试过如下

- name: make sure {{opendj_service_name}} is started
  sysvinit:
      name: {{opendj_service_name}}
      state: started
      enabled: yes

推荐阅读