From fcbed30139443b0d646cb364911f8c9d0aa4a6f5 Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Fri, 22 Jun 2018 17:23:13 +0200 Subject: [PATCH] add systemd unit to login api server --- roles/login/tasks/main.yaml | 18 ++++++------------ roles/login/templates/login.service | 13 +++++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 roles/login/templates/login.service diff --git a/roles/login/tasks/main.yaml b/roles/login/tasks/main.yaml index 2feb07d..3f0a625 100644 --- a/roles/login/tasks/main.yaml +++ b/roles/login/tasks/main.yaml @@ -47,11 +47,10 @@ notify: - restart login -- name: add login init script - template: src=login.j2 dest=/etc/init.d/login mode=755 - register: add_login_startup_script - notify: - - restart login +- name: add systemd service for api server + template: + src: login.service + dest: /etc/systemd/system/login.service - name: create /var/log/login.log file: @@ -72,10 +71,5 @@ systemd: daemon_reload: yes name: login - when: add_login_startup_script.changed - -- include_role: - name: service - vars: - service_name: login - service_packages: null + state: started + enabled: yes diff --git a/roles/login/templates/login.service b/roles/login/templates/login.service new file mode 100644 index 0000000..a087d4a --- /dev/null +++ b/roles/login/templates/login.service @@ -0,0 +1,13 @@ +[Unit] +Description=Login Web Service +After=network.target + +[Service] +Type=simple +User=login +Group=login +WorkingDirectory=/srv/login +ExecStart=/srv/login/server.py + +[Install] +WantedBy=multi-user.target