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