--- - name: "Create directory: /var/lib/rest-server" file: state: directory path: /var/lib/rest-server owner: "{{ services.rest_server.user }}" group: "{{ services.rest_server.user }}" notify: "Restart rest-server" - name: "[OpenRC] Create service file" template: src: openrc-service.j2 dest: /etc/init.d/rest-server mode: 0755 when: - ansible_service_mgr == "openrc" notify: "Restart rest-server" - name: "[systemd] Create service file" template: src: systemd-service.j2 dest: /etc/systemd/system/rest-server.service mode: 0755 when: - ansible_service_mgr == "systemd" notify: "Restart rest-server"