diff --git a/tasks/teamcity-server.yml b/tasks/teamcity-server.yml index 109f770..0f2c2a8 100644 --- a/tasks/teamcity-server.yml +++ b/tasks/teamcity-server.yml @@ -14,11 +14,19 @@ dest: "/etc/default/teamcity-server" mode: 0644 -- name: "Put TeamCity service file" +- name: "Put TeamCity service file (sysv)" template: - src: "teamcity-server.conf.j2" - dest: "/etc/init/teamcity-server.conf" + src: "teamcity-agent.conf.j2" + dest: "/etc/init/teamcity-agent.conf" mode: 0644 + when: "ansible_service_mgr != 'systemd'" + +- name: "Put TeamCity service file (systemd)" + template: + src: "teamcity-agent.service.j2" + dest: "/lib/systemd/system/teamcity-server.service" + mode: 0644 + when: "ansible_service_mgr == 'systemd'" - name: "Stop TeamCity Server before upgrade" service: diff --git a/templates/teamcity-server.service.j2 b/templates/teamcity-server.service.j2 new file mode 100644 index 0000000..4a78052 --- /dev/null +++ b/templates/teamcity-server.service.j2 @@ -0,0 +1,13 @@ +#/lib/systemd/system +[Unit] +Description="TeamCity Server" + +[Service] +Type=forking +User={{ teamcity_server_user_name }} +PIDFile={{ teamcity_server_dir }}/logs/teamcity-server.pid +ExecStart={{ teamcity_server_dir }}/bin/teamcity-server.sh start +ExecStop={{ teamcity_server_dir }}/bin/teamcity-server.sh stop + +[Install] +WantedBy=multi-user.target