summaryrefslogtreecommitdiff
path: root/git-server.yaml
blob: d94bd24b3eeefae289767786702234ac052e6ba5 (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
---
- name: Setup git server
  hosts: raspberry
  tasks:
     - name: Install packages
       become: true
       tags:
       - slow
       apt:
         pkg:
         - nginx
         - certbot
         - python3-certbot-nginx
         - cgit
         - libfcgi-dev
         - spawn-fcgi
         - fcgiwrap

    # user
     - name: Create git user
       become: true
       shell: |
         useradd git -m
         mkdir /home/git/.ssh

     - name: Copy SSH keys
       become: true
       copy:
         src: ~/.ssh/id_rsa.pub
         dest: /home/git/.ssh/authorized_keys

    # nginx
     - name: Copy nginx configuration
       become: true
       copy:
         src: ./files/nginx/cgit
         dest: /etc/nginx/sites-available

     - name: Enable website
       become: true
       command: "ln -sf /etc/nginx/sites-available/cgit /etc/nginx/sites-enabled"

     - name: Install SSL certificate
       become: true
       shell: "certbot --nginx --non-interactive --agree-tos -m eugene@eug-vs.xyz -d git.eug-vs.xyz"

     - name: Restart and enable nginx
       become: true
       systemd:
         name: nginx
         enabled: yes
         state: restarted

    # cgit
     - name: Copy cgit configuration
       become: true
       copy:
         src: ./files/cgit/cgitrc
         dest: /etc
    # TODO: move this to eug-vs-xyz
     - name: Copy cgit styles
       become: true
       copy:
         src: ./files/cgit/cgit
         dest: /usr/share