aboutsummaryrefslogtreecommitdiff
path: root/roles/gitea/tasks/main.yml
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-10-09 19:04:39 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-10-09 19:04:39 +0200
commite920a10a5c15b53683ee5caff122ec9378032cd5 (patch)
treec51dd14cfad71c8c543c8ab2f43b54c227507ef9 /roles/gitea/tasks/main.yml
parente11720ab7511e32c8e9e62b94f6578703eac6c42 (diff)
downloadansible_collection-e920a10a5c15b53683ee5caff122ec9378032cd5.tar.gz
gitea: WIP
Diffstat (limited to 'roles/gitea/tasks/main.yml')
-rw-r--r--roles/gitea/tasks/main.yml103
1 files changed, 103 insertions, 0 deletions
diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml
new file mode 100644
index 0000000..a5d7081
--- /dev/null
+++ b/roles/gitea/tasks/main.yml
@@ -0,0 +1,103 @@
+---
+- name: Install packages
+ apt:
+ name:
+ - git
+ become: yes
+
+- name: Create User
+ user:
+ name: git
+ home: /home/git
+ shell: /bin/bash
+ system: yes
+ state: present
+ become: yes
+
+- name: Folder structure
+ file:
+ path: '{{ item }}'
+ owner: git
+ group: git
+ mode: '750'
+ state: directory
+ become: yes
+ loop:
+ - /var/lib/gitea/
+ - /var/lib/gitea/custom
+ - /var/lib/gitea/data
+ - /var/lib/gitea/log
+
+- name: Config folder
+ file:
+ path: /etc/gitea
+ owner: root
+ group: git
+ mode: '750'
+ state: directory
+ become: yes
+
+- name: Check for update
+ stat:
+ path: /usr/local/bin/gitea
+ checksum_algorithm: sha256
+ register: gitea_bin_stat
+ ignore_errors: yes
+
+- name: perform update
+ include: update.yml
+ when:
+ - (not gitea_bin_stat.stat.exists) or (gitea_bin_stat.stat.checksum != gitea.version.sha)
+
+- name: Check if initial setup is needed
+ include_tasks: secrets.yml
+
+- name: Read secret Key
+ slurp:
+ src: /etc/gitea/secret_key
+ become: yes
+ register: sec_key
+
+- name: Read secret Key
+ slurp:
+ src: /etc/gitea/internal_token
+ become: yes
+ register: int_tok
+
+- name: Install gitea config file
+ template:
+ src: app.ini.j2
+ dest: /etc/gitea/app.ini
+ owner: root
+ group: git
+ mode: '640'
+ become: yes
+ notify:
+ - Handle systemd
+
+- name: Check for changed cert
+ command: /bin/true
+ when:
+ - cert_changed
+ notify:
+ - Handle systemd
+
+- name: Install gitea unit file
+ copy:
+ src: gitea.service
+ dest: /etc/systemd/system/gitea.service
+ become: yes
+ notify:
+ - Handle systemd
+
+- name: Flush handlers
+ meta: flush_handlers
+
+- name: Wait 10s for gitea to start
+ wait_for:
+ timeout: 10
+ delegate_to: localhost
+# This only install base configuration. Group settings have to be set manually in gitea...
+- name: Install LDAP
+ include_tasks: ldap.yml
+ when: gitea.ldap.enable