I use the template module to install the .service file in /etc/systemd/system . According to this message in the digital ocean /lib/systemd/system should be reserved for packages bundled with the OS itself, and third-party services should be defined in /etc/systemd/system .
Using the systemd module with which I could start the service, I have to start the daemon_reload=yes .
Before Ansible 2.2 : after that I can do systemctl daemon-reload (for this, perhaps use the ansible handler for this) so that prod systemd picks up a new file.
- name: install myservice systemd unit file template: src=myservice.j2 dest=/etc/systemd/system/myservice.service - name: start myservice systemd: state=started name=myservice daemon_reload=yes
source share