Skip to content

Commit

Permalink
ansible: fewer hard-coded paths in roles
Browse files Browse the repository at this point in the history
  • Loading branch information
miku committed Feb 8, 2022
1 parent 5eb64b7 commit 3ca2e72
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
- name: "Install solrdump"
apt:
# https://github.com/ubleipzig/solrdump/releases
deb: https://github.com/ubleipzig/solrdump/releases/download/v0.1.7/solrdump_0.1.7_amd64.deb
deb: https://github.com/ubleipzig/solrdump/releases/download/v{{ solrdump_version }}/solrdump_{{ solrdump_version }}_amd64.deb
5 changes: 5 additions & 0 deletions ansible/roles/labe/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
labe_user: labe
labe_group: labe
labe_data_dir: /usr/share/labe
labed_addr: 0.0.0.0:8000
labed_access_log: /var/log/labe-access.log
labed_log: /var/log/labe.log
ckit_version: 0.1.37
labe_version: 0.1.37
solrdump_version: 0.1.7

14 changes: 10 additions & 4 deletions ansible/roles/labe/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
apt:
deb: https://github.com/slub/labe/releases/download/v{{ ckit_version }}/ckit_{{ ckit_version }}_amd64.deb

- name: "Override package ckit/labed systemd unit file"
template:
src: "labed.service.j2"
dest: "/etc/systemd/system/labed.service"
mode: 0644

- name: "Install labe release"
apt:
deb: https://github.com/slub/labe/releases/download/v{{ labe_version }}/labe_{{ labe_version}}_amd64.deb
Expand All @@ -24,15 +30,15 @@

- name: "Change application log file ownership"
file:
path: /var/log/labe.log
path: "{{ labed_log }}"
owner: "{{ labe_user }}"
group: "{{ labe_group }}"
state: touch
mode: '0644'

- name: "Change access log file ownership"
file:
path: /var/log/labe-access.log
path: "{{ labed_access_log }}"
owner: "{{ labe_user }}"
group: "{{ labe_group }}"
state: touch
Expand All @@ -57,7 +63,7 @@
lp_logrotate_confd:
- path: labe
conf: |
/var/log/labe.log {
{{ labed_log }} {
daily
rotate 3
size 100M
Expand All @@ -66,7 +72,7 @@
}
- path: labe-access
conf: |
/var/log/labe-access.log {
{{ labed_access_log }} {
daily
rotate 3
size 100M
Expand Down
25 changes: 25 additions & 0 deletions ansible/roles/labe/templates/labed.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[Unit]
Description=Server for labe citation project
Documentation=https://www.github.com/slub/labe
After=network.target

[Service]
Type=simple
User={{ labe_user }}
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/labed \
-addr {{ labed_addr }} \
-a {{ labed_access_log }} \
-logfile {{ labed_log }} \
-c \
-z \
-i {{ labe_data_dir }}/data/IdMappingDatabase/current \
-o {{ labe_data_dir }}/data/OpenCitationsDatabase/current \
-m {{ labe_data_dir }}/data/SolrDatabase/current-ai-short \
-m {{ labe_data_dir }}/data/SolrDatabase/current-main-short \
-m {{ labe_data_dir }}/data/SolrDatabase/current-slub-production
Restart=on-failure

[Install]
WantedBy=multi-user.target

0 comments on commit 3ca2e72

Please sign in to comment.