summaryrefslogtreecommitdiff
path: root/taskd.yaml
blob: e006f3c69a9155454a25aafbfc60c86759b18b08 (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
---
- name: Install taskd
  hosts: raspberry
  tasks:
  # Installation
  # TODO: install from repository when finally supported for aarch64
     - name: Install build tools
       tags:
       - slow
       apt:
         pkg:
         - gcc
         - make
         - cmake
         - gnutls-dev
         - uuid-dev

     - name: Build taskd from source
       tags:
       - slow
       shell: |
         cd /tmp
         git clone --recursive https://github.com/GothenburgBitFactory/taskserver.git
         cd taskserver
         cmake -DCMAKE_BUILD_TYPE=release .
         make

     - name: Install taskd
       become: true
       shell: |
         cd /tmp/taskserver
         make install

     - name: Create user
       become: true
       user:
         name: taskd

    # Configuration
     - name: Create data folder
       become: true
       shell: mkdir -p /var/lib/taskd/orgs

     - name: Push configuration file
       become: true
       copy:
         src: ./files/taskd/config
         dest: /var/lib/taskd

     - name: Push vars for generating keys
       copy:
         src: ./files/taskd/vars
         dest: /tmp/taskserver/pki

     - name: Generate keys & certificates
       become: true
       shell: |
         cd /tmp/taskserver/pki
         sed 's/localhost/taskd.eug-vs.xyz/' -i vars
         sed 's/365/0/' -i vars
         ./generate
         cp api.*.pem /var/lib/taskd
         cp server.*.pem /var/lib/taskd
         cp ca.cert.pem /var/lib/taskd

     - name: Change ownership
       become: true
       shell: chown -R taskd:taskd /var/lib/taskd

     - name: Create log file
       become: true
       shell: |
         touch /var/log/taskd.log
         chown -R taskd:taskd /var/log/taskd.log

     - name: Add hostname
       become: true
       shell: echo "192.168.0.131 taskd.eug-vs.xyz" >> /etc/hosts

     - name: Create systemd unit
       copy:
         src: ./files/taskd/taskd.service
         dest: /etc/systemd/system

     - name: Enable and start the service
       become: true
       systemd:
         name: taskd
         state: restarted