I'm just getting my feet wet with Ansible 2.2 and Devops and I've run into the following problem. I have a host test-host to which I deployed a MySQL server (using geerlingguy.mysql).
The role uses the following handler to restart the service:
---
- name: restart MySQL
service: "name={{ mysql_daemon }} state=restarted sleep=5"
Which, I thought, uses the Ansibles service module to restart the server. However, that fails
So just to rule out any weirdness with that custom role, I've tried to execute the module directly like so:
unsupported parameter for module:sleep
ansible test-host -b -m service -a 'name=mysql sleep=5 state=restarted'
With the same result
Running Ansible with more verbose output shows (among other things):
Running systemd
Using module file /usr/local/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/modules/core/system/systemd.py
So it appears that the systemd module is used instead of service (looking into the module shows that it is indeed aliased to service). And, lo and behold, systemd does not support the sleep parameter. How to fix this?