summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-10-16 14:54:24 +0100
committerNick White <git@njw.name>2019-10-16 14:54:24 +0100
commit0d8bcbfd9a7f7ba4fd884c91e19835f8b3bf1a70 (patch)
tree7382c4a5c37dbe05c2266ca93532877cdf299887
parent258df96af944b3665e827144fb577179837e2d86 (diff)
Update pipeliner to update before running bookpipeline, and with latest urls
-rw-r--r--roles/pipeliner/files/bookpipeline.service1
-rw-r--r--roles/pipeliner/tasks/pipeline.yml22
-rw-r--r--roles/pipeliner/templates/updatepipeline.j25
3 files changed, 23 insertions, 5 deletions
diff --git a/roles/pipeliner/files/bookpipeline.service b/roles/pipeliner/files/bookpipeline.service
index 063cda1..d68c730 100644
--- a/roles/pipeliner/files/bookpipeline.service
+++ b/roles/pipeliner/files/bookpipeline.service
@@ -2,6 +2,7 @@
Description=Book Pipeline
[Service]
+ExecStartPre=/usr/local/bin/updatepipeline
ExecStart=/usr/local/bin/bookpipeline -v
Restart=always
User=admin
diff --git a/roles/pipeliner/tasks/pipeline.yml b/roles/pipeliner/tasks/pipeline.yml
index 293e581..7186f83 100644
--- a/roles/pipeliner/tasks/pipeline.yml
+++ b/roles/pipeliner/tasks/pipeline.yml
@@ -24,12 +24,16 @@
# Do this manually rather than relying on go get so that step can
# be skipped if nothing has been changed
- name: Get go repo
- git: dest=/home/{{ ansible_user }}/src/go/src/rescribe.xyz/go.git repo=https://rescribe.xyz/go.git
+ git: dest=/home/{{ ansible_user }}/src/go/src/rescribe.xyz/{{ item }} repo=https://git.rescribe.xyz/{{ item }}
become: no
+ with_items:
+ - bookpipeline
+ - preproc
+ - utils
register: gorepo
- name: Get and build bookpipeline and dependencies
- command: go get rescribe.xyz/go.git/bookpipeline/...
+ command: go get -u rescribe.xyz/bookpipeline/...
environment:
GOPATH: /home/{{ ansible_user }}/src/go
become: no
@@ -40,13 +44,21 @@
remote_src: true
src: /home/{{ ansible_user }}/src/go/bin/bookpipeline
dest: /usr/local/bin/
+ owner: root
+ group: root
+ mode: 0755
-- name: Make bookpipeline executable
- file: path=/usr/local/bin/bookpipeline mode=0755
+- name: Install updatepipeline script
+ template:
+ src: updatepipeline.j2
+ dest: /usr/local/bin/updatepipeline
+ owner: root
+ group: root
+ mode: 0755
- name: Install systemd unit file
copy: src=bookpipeline.service dest=/etc/systemd/system
notify: reload daemons
-- name: Enable bookpipeline service
+- name: Enable service
service: name=bookpipeline enabled=true
diff --git a/roles/pipeliner/templates/updatepipeline.j2 b/roles/pipeliner/templates/updatepipeline.j2
new file mode 100644
index 0000000..9a375ca
--- /dev/null
+++ b/roles/pipeliner/templates/updatepipeline.j2
@@ -0,0 +1,5 @@
+#!/bin/sh
+g="/home/{{ ansible_user }}/src/go"
+
+GOPATH="$g" go get -u rescribe.xyz/bookpipeline/... && \
+sudo cp "$g/bin/bookpipeline" /usr/local/bin/