roles/python_stuff/templates/python.service.j2 (view raw)
1[Unit]
2Description=A Python project.
3After=syslog.target network.target
4
5[Service]
6Type=simple
7Restart=always
8RestartSec=1
9WorkingDirectory={{ repo_dir }}{{ item }}
10ExecStart={{ repo_dir }}{{ item }}/venv/bin/python {{ repo_dir }}{{ item }}/main.py
11User={{ user }}
12StandardOutput=syslog
13StandardError=syslog
14SyslogIdentifier= {{ item }}
15
16[Install]
17WantedBy=multi-user.target