skip to Main Content

This is my task.

- name: Ensure fail2ban is running and enabled.
  ansible.builtin.service:
   name: fail2ban
   state: started
   enabled: true

I am getting this error.

'fatal: [localhost]: FAILED! => {"changed": false, "msg": "get_service_tools not implemented on target platform"}'

Need help!!

Thanks for your time.

2

Answers


  1. Chosen as BEST ANSWER

    I am getting this error because I was trying to execute on my local which is Mac OS.

        when: ansible_facts['os_family'] == "Debian"
    

    I have used this condition so that it will only execute when the target platform is of Debian.


  2. The service module – Manage services is just

    a proxy for multiple more specific service manager modules (such as ansible.builtin.systemd and ansible.builtin.sysvinit).

    and

    Controls services on remote hosts. Supported init systems include BSD init, OpenRC, SysV, Solaris SMF, systemd, upstart.

    According the source code ansible/modules/service.py the error message

    get_service_tools not implemented on target platform
    

    shouldn’t happen for systems with systemd, but in example for launchd. See Ansible Issue #10412 "Ansible OSX get_service_tools not implemented on target platform".

    So you could try with systemd module – Manage systemd units and if fail2ban has a fail2ban.service file implemented correctly.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search