summaryrefslogtreecommitdiff
path: root/roles/rudpad/tasks/main.yml
blob: 6a39baf74ee6dc7ecaf7ecc1eacc91fdff1d8f77 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---

- name: Update apt
  apt:
    update_cache: yes

- name: Install packages
  apt:
    state: present
    name:
    - gcc
    - git
    - imagemagick
    - libssl-dev # needed for getxbook
    - make
    - poppler-utils # for pdfimages
    - rclone

- name: Download Go
  get_url:
    url: https://golang.org/dl/go1.17.linux-amd64.tar.gz
    dest: /home/{{ ansible_user }}
  become: no

- name: Install Go
  unarchive:
    dest: /usr/local
    src: /home/{{ ansible_user }}/go1.17.linux-amd64.tar.gz
    remote_src: true

- name: Remove Go download
  file:
    path: /home/{{ ansible_user }}/go1.17.linux-amd64.tar.gz
    state: absent
  become: no

- name: Add Go tools to path
  lineinfile:
    path: /home/{{ ansible_user }}/.profile
    line: PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
  become: no

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

- name: Download necessary parts for rescribe building
  command:
    cmd: /usr/local/go/bin/go generate
    chdir: /home/{{ ansible_user }}/src/bookpipeline/cmd/rescribe
  become: no
  environment:
    PATH: /usr/local/go/bin

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

- name: Get getxbook
  git:
    dest: /home/{{ ansible_user }}/src/getxbook
    repo: https://git.njw.name/getxbook.git
    force: yes
  become: no

- name: Build getxbook
  make:
    chdir: /home/{{ ansible_user }}/src/getxbook
    target: all
  become: no

- name: Install getxbook
  make:
    chdir: /home/{{ ansible_user }}/src/getxbook
    target: install
    params:
      PREFIX: /home/{{ ansible_user }}/.local

- name: Create rclone config directory
  file:
    path: /home/{{ ansible_user }}/.config/rclone
    state: directory
  become: no

- name: Configure rclone
  copy:
    src: rclone.conf
    dest: /home/{{ ansible_user }}/.config/rclone/rclone.conf
  become: no