Skip to content

Commit

Permalink
Extended Systemd Service
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Nov 21, 2024
1 parent 15c0de2 commit a22d962
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
18 changes: 1 addition & 17 deletions roles/semaphore/tasks/present.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
- "{{ semaphore_config_dir }}"
- /home/semaphore/tmp

- name: Copy requirements
- name: Copy requirements for ExecStartPre
ansible.builtin.copy:
src: "{{ item }}"
dest: /home/semaphore/
Expand All @@ -110,22 +110,6 @@
- requirements.txt
- requirements.yml

- name: Install requirements for semaphore user
become: true
become_user: semaphore
ansible.builtin.pip:
requirements: '/home/semaphore/requirements.txt'
executable: /usr/bin/pip3.12
extra_args: '--user'
state: present

- name: Install collections
become: true
become_user: semaphore
ansible.builtin.command:
cmd: ansible-galaxy collection install -r /home/semaphore/requirements.yml
changed_when: true

- name: Deploy Semaphore Config
become: true
ansible.builtin.template:
Expand Down
13 changes: 12 additions & 1 deletion roles/semaphore/templates/semaphore.service.j2
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
[Unit]
Description=Semaphore UI
Documentation=https://github.com/semaphoreui/semaphore
Requires=network.target
After=network.target syslog.target
Documentation=https://github.com/semaphoreui/semaphore
ConditionPathExists=/usr/bin/semaphore
ConditionPathExists=/etc/semaphore/config.json

[Service]
User=semaphore
Group=semaphore
Environment=LANG="en_US.UTF-8"
Environment=LC_ALL="en_US.UTF-8"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/.local/bin"
ExecStart=/usr/bin/semaphore server --config /etc/semaphore/config.json
ExecStop=/bin/kill -s QUIT $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID
Restart=always
RestartSec=25s
WorkingDirectory=/home/semaphore
StandardOutput=journal
StandardError=journal
SyslogIdentifier=semaphore

ExecStartPre=/bin/bash -c 'pip3.12 install --upgrade --user -r /home/semaphore/requirements.txt'
ExecStartPre=/bin/bash -c 'ansible-galaxy collection install --upgrade -r /home/semaphore/requirements.yml'

[Install]
WantedBy=multi-user.target

0 comments on commit a22d962

Please sign in to comment.