diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..e865888 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,26 @@ +--- + +# See https://docs.gitea.io/en-us/config-cheat-sheet/ for additional documentation. +# Default based on https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini +gitea_config: + DEFAULT: + APP_NAME: ; Gitea: Git with a cup of tea + RUN_USER: ; git + server: + database: + DB_TYPE: mysql + HOST: 127.0.0.1:3306 ; can use socket e.g. /var/run/mysqld/mysqld.sock + NAME: gitea + USER: root + security: + INSTALL_LOCK: false + SECRET_KEY: + INTERNAL_TOKEN: + camo: + oauth2: + ENABLE: true + log: + MODE: console + LEVEL: Info + git: + service: diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..0c70409 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,6 @@ +--- + +- name: Gitea | Restart + service: + name: gitea + state: restarted diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..6b649ff --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,24 @@ +--- + +- name: Gitea | Install package + package: + name: gitea + state: present + +- name: Gitea | Deploy config + copy: + src: app.ini.j2 + dest: /etc/gitea/app.ini + mode: 0600 + owner: gitea + group: gitea + notify: Gitea | Restart + +- name: Gitea | Run handlers + meta: flush_handlers + +- name: Gitea | Enable and start service + service: + name: gitea + state: started + enabled: yes diff --git a/templates/app.ini.j2 b/templates/app.ini.j2 new file mode 100644 index 0000000..8b14002 --- /dev/null +++ b/templates/app.ini.j2 @@ -0,0 +1,7 @@ +;; {{ ansible_managed }} +{% for section, settings in gitea_config.items() %} +[{{ section }}] +{% for param, value in settings.items() %} +{{ param }} = {{ value }} +{% endfor %} +{% endfor %}