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
I am getting this error because I was trying to execute on my local which is Mac OS.
I have used this condition so that it will only execute when the target platform is of Debian.
The
service
module – Manage services is justand
According the source code
ansible/modules/service.py
the error messageshouldn’t happen for systems with
systemd
, but in example forlaunchd
. See Ansible Issue #10412 "Ansible OSXget_service_tools
not implemented on target platform".So you could try with
systemd
module – Manage systemd units and iffail2ban
has afail2ban.service
file implemented correctly.