Search code examples
ansiblesystemdinit.d

Is it possible to use start init.d service using Ansible?


Ansible will fail the task below

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

because the service is a init.d service and not systemd

Is it possibe to start a init.d service using Ansible?


Solution

  • Have you tried as below

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