diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-03-23 14:09:58 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-03-23 14:09:58 +0300 |
commit | 29d16c46dfbc8eb9a31b10a5bf72f1330c890d5c (patch) | |
tree | 07bec8926ee075116c30191ce86652cc0ebbbb3e /git-server.yaml | |
download | infrastructure-29d16c46dfbc8eb9a31b10a5bf72f1330c890d5c.tar.gz |
feat: add website and git-server playbooks
Diffstat (limited to 'git-server.yaml')
-rw-r--r-- | git-server.yaml | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/git-server.yaml b/git-server.yaml new file mode 100644 index 0000000..d94bd24 --- /dev/null +++ b/git-server.yaml @@ -0,0 +1,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 + |