From 0d8bcbfd9a7f7ba4fd884c91e19835f8b3bf1a70 Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 16 Oct 2019 14:54:24 +0100 Subject: Update pipeliner to update before running bookpipeline, and with latest urls --- roles/pipeliner/files/bookpipeline.service | 1 + roles/pipeliner/tasks/pipeline.yml | 22 +++++++++++++++++----- roles/pipeliner/templates/updatepipeline.j2 | 5 +++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 roles/pipeliner/templates/updatepipeline.j2 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/ -- cgit v1.2.1-24-ge1ad