[ansible] added service role

This commit is contained in:
2018-03-26 22:06:22 +03:00
parent 7a57f22967
commit f6ebec32ca
7 changed files with 29 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
- name: install tankz systemd unit file
template: src=template/tankz.j2 dest=/etc/systemd/system/tankz.service
- name: start tankz
systemd: state=started name=tankz daemon_reload=yes

View File

@@ -0,0 +1,16 @@
[Unit]
Description=Tank'z game server
[Service]
Type=simple
PIDFile=/var/run/tankz.pid
WorkingDirectory=/home/holop/repo/tankz/current/target
User=www-data
Group=www-data
ExecStart=/usr/bin/neko /home/holop/repo/tankz/current/target/tankz.n
TimeoutSec=300
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,3 @@
ansible_become: yes
ansible_user: barin
ansible_become_pass: 1234!QAZ

3
ansible/setup.yml Normal file
View File

@@ -0,0 +1,3 @@
- hosts: all
roles:
- service

View File

@@ -2,7 +2,7 @@ role :app, %w{localhost}
role :web, %w{localhost} role :web, %w{localhost}
role :db, %w{localhost} role :db, %w{localhost}
set :user, ENV['USER'] #set :user, ENV['USER']
user = fetch(:user) user = fetch(:user)
server 'localhost', ssh_options: { port: 22, user: user, forward_agent: true } server 'localhost', ssh_options: { port: 22, user: user, forward_agent: true }

View File

@@ -30,7 +30,7 @@ class JsConnection<O:Message, I:Message> extends BaseConnection<O, I> {
} }
private function buildSocket(host:String, port:Int):WebSocket { private function buildSocket(host:String, port:Int):WebSocket {
return untyped __js__("new WebSocket('ws://'+host+':'+port);"); return untyped __js__('new WebSocket("ws://${host}:${port}");');
} }
override public function connect():Promise<IConnection<O, I>> { override public function connect():Promise<IConnection<O, I>> {