summaryrefslogtreecommitdiff
path: root/roles/pipeliner/tasks/pipeline.yml
blob: 38c2a01aa42405a08ff32b503875e152076de467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---

# This shouldn't be needed due to update_cache line in the below install rule,
# however that doesn't seem to trigger for some reason
- name: Update apt
  apt:
    update_cache: yes

- name: Install golang
  ansible.builtin.unarchive:
    src: https://golang.org/dl/go1.17.3.linux-amd64.tar.gz
    dest: /usr/local
    remote_src: yes
  become: yes

- name: Get go repo
  git:
    dest: /home/{{ ansible_user }}/src/bookpipeline
    repo: https://git.rescribe.xyz/bookpipeline
    force: yes
  become: no

- name: Get and build bookpipeline and dependencies
  command:
    cmd: /usr/local/go/bin/go install ./cmd/bookpipeline
    chdir: /home/{{ ansible_user }}/src/bookpipeline
  become: no

- name: Install bookpipeline binary
  copy:
    remote_src: true
    src: /home/{{ ansible_user }}/go/bin/bookpipeline
    dest: /usr/local/bin/
    owner: root
    group: root
    mode: 0755

- name: Install updatepipeline script
  template:
    src: updatepipeline.j2
    dest: /usr/local/bin/updatepipeline
    owner: root
    group: root
    mode: 0755

- name: Create settings directory
  file:
    path: /home/admin/.config/bookpipeline
    state: directory
    owner: admin
    group: admin
    mode: 0755

- name: Install mail settings
  copy:
    src: mailsettings
    dest: /home/admin/.config/bookpipeline/mailsettings
    owner: admin
    group: admin
    mode: 0600

- name: Install systemd unit file
  copy: src=bookpipeline.service dest=/etc/systemd/system
  notify: reload daemons

- name: Enable service
  service: name=bookpipeline enabled=true