5 Commits

Author SHA1 Message Date
Tom
2004182b7e Merge pull request 'Linting during the CI.' (#3) from development into main
All checks were successful
Test the role / test-the-role (push) Successful in 8s
Reviewed-on: #3
2026-02-18 18:01:06 +01:00
39ca068451 Linting in CI.
All checks were successful
Test the role / test-the-role (push) Successful in 8s
2026-02-18 17:59:46 +01:00
0153639c38 Preparing v3.0.3. 2026-02-18 17:16:30 +01:00
c81f75b055 Readme update. 2026-02-18 16:58:19 +01:00
02dd1f773e Linter validation. 2026-02-18 16:54:14 +01:00
7 changed files with 41 additions and 28 deletions

10
.gitea/workflows/test.yml Normal file
View File

@@ -0,0 +1,10 @@
name: Test the role
on:
- push
jobs:
test-the-role:
runs-on: iron-runner
steps:
- uses: actions/checkout@v6
- run: ansible-lint --profile production .

View File

@@ -2,20 +2,17 @@
#+AUTHOR: DeadSwitch | The Silent Architect #+AUTHOR: DeadSwitch | The Silent Architect
#+OPTIONS: toc:nil num:nil \n:t #+OPTIONS: toc:nil num:nil \n:t
[[https://opensource.org/licenses/MIT][https://img.shields.io/badge/license-MIT-blue.svg]] [[https://img.shields.io/badge/version-3.0.2-green.svg]] [[https://opensource.org/licenses/MIT][https://img.shields.io/badge/license-MIT-blue.svg]] [[https://img.shields.io/badge/version-3.0.3-green.svg]]
* ds-gitea * ds_gitea
This role can install and configures a [[https://docs.gitea.com/][Gitea]] server. This role can install and configures a [[https://docs.gitea.com/][Gitea]] server.
It uses SQLite as its default database service - with optional PostgreSQL support (=ds-posgresql=). - It uses SQLite as its default database service - with optional PostgreSQL support (=ds-posgresql=).
- The role can set up a reverse proxy with SSL using Nginx (=ds-nginx=).
The role can set up a reverse proxy with SSL using Nginx (=ds-nginx=). - Self-signed certificates and Let's Encrypt with =certbot= are supported.
Self-signed certificates and Let's Encrypt with =certbot= are supported. - The =ds-ufw= role can configure the firewall.
- The =ds-act_runner= role can configure and register Actions runners.
The =ds-ufw= role can configure the firewall.
The =ds-act_runner= role can configure and register Actions runners.
* Role Behavior * Role Behavior
@@ -150,7 +147,7 @@ You can find more playbook examples in the =examples= directory.
gitea_db_password: Eegh7Aothooph7pa6eu7eitha_zaim0G gitea_db_password: Eegh7Aothooph7pa6eu7eitha_zaim0G
roles: roles:
- role: ds-gitea - role: ds_gitea
#+end_src #+end_src
* License * License

View File

@@ -4,9 +4,9 @@
become: true become: true
roles: roles:
- role: ds-postgresql - role: ds_postgresql
- role: ds-nginx - role: ds_nginx
- role: ds-gitea - role: ds_gitea
vars: vars:
gitea_user: git gitea_user: git
gitea_group: git gitea_group: git
@@ -26,9 +26,9 @@
gitea_certbot_email: tom@tomsitcafe.com gitea_certbot_email: tom@tomsitcafe.com
gitea_ssl_cert: /etc/letsencrypt/live/{{ gitea_domain }}/fullchain.pem gitea_ssl_cert: /etc/letsencrypt/live/{{ gitea_domain }}/fullchain.pem
gitea_ssl_key: /etc/letsencrypt/live/{{ gitea_domain }}/privkey.pem gitea_ssl_key: /etc/letsencrypt/live/{{ gitea_domain }}/privkey.pem
gitea_ssl_trusted_certificate: /etc/letsencrypt/live/{{ gitea_domain }}/chain.pem gitea_ssl_trusted_certificate: /etc/letsencrypt/live/{{ gitea_domain }}/chain.pem
# Secrets to SOPS # Secrets to SOPS
gitea_lfs_jwt_secret: G9bZrRHMhRQ8w4R0KkH2VLnx2rzq81ROQ951IQjlMs4 gitea_lfs_jwt_secret: G9bZrRHMhRQ8w4R0KkH2VLnx2rzq81ROQ951IQjlMs4
gitea_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzA2Mzk1Njh9.ybbaeNLFiLbyvxfj4vkqhXSAXKRGpwvP8jIm9YLPgXw gitea_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzA2Mzk1Njh9.ybbaeNLFiLbyvxfj4vkqhXSAXKRGpwvP8jIm9YLPgXw
gitea_jwt_secret: uJni4x4e0AzpkLYc-t4keRJKOB6EaLzwVsdLeamkFyU gitea_jwt_secret: uJni4x4e0AzpkLYc-t4keRJKOB6EaLzwVsdLeamkFyU
gitea_db_password: Eegh7Aothooph7pa6eu7eitha_zaim0G gitea_db_password: Eegh7Aothooph7pa6eu7eitha_zaim0G

View File

@@ -3,7 +3,7 @@
become: true become: true
roles: roles:
- role: ds-gitea - role: ds_gitea
vars: vars:
gitea_user: git gitea_user: git
gitea_group: git gitea_group: git
@@ -16,6 +16,6 @@
gitea_ssh_port: 22 gitea_ssh_port: 22
gitea_root_url: http://{{ gitea_domain }}:{{ gitea_http_port }} gitea_root_url: http://{{ gitea_domain }}:{{ gitea_http_port }}
# Secrets to SOPS # Secrets to SOPS
gitea_lfs_jwt_secret: G9bZrRHMhRQ8w4R0KkH2VLnx2rzq81ROQ951IQjlMs4 gitea_lfs_jwt_secret: G9bZrRHMhRQ8w4R0KkH2VLnx2rzq81ROQ951IQjlMs4
gitea_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzA2Mzk1Njh9.ybbaeNLFiLbyvxfj4vkqhXSAXKRGpwvP8jIm9YLPgXw gitea_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzA2Mzk1Njh9.ybbaeNLFiLbyvxfj4vkqhXSAXKRGpwvP8jIm9YLPgXw
gitea_jwt_secret: uJni4x4e0AzpkLYc-t4keRJKOB6EaLzwVsdLeamkFyU gitea_jwt_secret: uJni4x4e0AzpkLYc-t4keRJKOB6EaLzwVsdLeamkFyU

View File

@@ -3,9 +3,9 @@
become: true become: true
roles: roles:
- role: ds-postgresql - role: ds_postgresql
- role: ds-nginx - role: ds_nginx
- role: ds-gitea - role: ds_gitea
vars: vars:
gitea_user: git gitea_user: git
gitea_group: git gitea_group: git
@@ -25,7 +25,7 @@
gitea_ssl_key: /var/lib/gitea/certs/key.pem gitea_ssl_key: /var/lib/gitea/certs/key.pem
gitea_enable_http_redirect: true gitea_enable_http_redirect: true
# Secrets to SOPS # Secrets to SOPS
gitea_lfs_jwt_secret: G9bZrRHMhRQ8w4R0KkH2VLnx2rzq81ROQ951IQjlMs4 gitea_lfs_jwt_secret: G9bZrRHMhRQ8w4R0KkH2VLnx2rzq81ROQ951IQjlMs4
gitea_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzA2Mzk1Njh9.ybbaeNLFiLbyvxfj4vkqhXSAXKRGpwvP8jIm9YLPgXw gitea_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzA2Mzk1Njh9.ybbaeNLFiLbyvxfj4vkqhXSAXKRGpwvP8jIm9YLPgXw
gitea_jwt_secret: uJni4x4e0AzpkLYc-t4keRJKOB6EaLzwVsdLeamkFyU gitea_jwt_secret: uJni4x4e0AzpkLYc-t4keRJKOB6EaLzwVsdLeamkFyU
gitea_db_password: Eegh7Aothooph7pa6eu7eitha_zaim0G gitea_db_password: Eegh7Aothooph7pa6eu7eitha_zaim0G

View File

@@ -9,6 +9,7 @@
state: present state: present
- name: Set up the PostgreSQL database - name: Set up the PostgreSQL database
when: gitea_database_server | default('') == "postgresql"
block: block:
- name: Ensure PostgreSQL Python client is installed - name: Ensure PostgreSQL Python client is installed
ansible.builtin.apt: ansible.builtin.apt:
@@ -21,6 +22,7 @@
name: gitea name: gitea
password: "{{ gitea_db_password }}" password: "{{ gitea_db_password }}"
role_attr_flags: "NOSUPERUSER,NOCREATEDB,NOCREATEROLE" role_attr_flags: "NOSUPERUSER,NOCREATEDB,NOCREATEROLE"
become: true
become_user: postgres become_user: postgres
- name: Create the gitea database - name: Create the gitea database
@@ -31,6 +33,7 @@
encoding: UTF8 encoding: UTF8
lc_collate: en_US.UTF-8 lc_collate: en_US.UTF-8
lc_ctype: en_US.UTF-8 lc_ctype: en_US.UTF-8
become: true
become_user: postgres become_user: postgres
- name: Ensure pg_hba.conf has local access for gitea - name: Ensure pg_hba.conf has local access for gitea
@@ -39,12 +42,12 @@
regexp: '^local\s+giteadb\s+gitea\s+' regexp: '^local\s+giteadb\s+gitea\s+'
line: 'local giteadb gitea scram-sha-256' line: 'local giteadb gitea scram-sha-256'
state: present state: present
backup: yes backup: true
notify: notify:
- Reload_postgresql - Reload_postgresql
when: gitea_database_server | default('') == "postgresql"
- name: Set up the reverse proxy - name: Set up the reverse proxy
when: gitea_reverse_proxy | default('') == "nginx"
block: block:
- name: Deploy the site configuration - name: Deploy the site configuration
ansible.builtin.template: ansible.builtin.template:
@@ -64,7 +67,6 @@
group: root group: root
force: true force: true
notify: Reload_nginx notify: Reload_nginx
when: gitea_reverse_proxy | default('') == "nginx"
- name: Create the gitea group - name: Create the gitea group
ansible.builtin.group: ansible.builtin.group:
@@ -80,12 +82,15 @@
password: '*' password: '*'
system: true system: true
create_home: true create_home: true
- name: Download the Gitea binary - name: Download the Gitea binary
ansible.builtin.get_url: ansible.builtin.get_url:
url: "{{ gitea_binary_url }}" url: "{{ gitea_binary_url }}"
dest: /usr/local/bin/gitea dest: /usr/local/bin/gitea
checksum: "sha256:{{ gitea_checksum_url }}" checksum: "sha256:{{ gitea_checksum_url }}"
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: '0750'
- name: Set the permissions of the Gitea binary - name: Set the permissions of the Gitea binary
ansible.builtin.file: ansible.builtin.file:
@@ -103,7 +108,7 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: lets-encrypt.yml file: lets-encrypt.yml
when: gitea_lets_encrypt | default(false) when: gitea_lets_encrypt | default(false)
- name: Pause to generate and save the secrets in SOPS - name: Pause to generate and save the secrets in SOPS
ansible.builtin.pause: ansible.builtin.pause:
prompt: | prompt: |
@@ -170,7 +175,7 @@
mode: '0640' mode: '0640'
notify: notify:
- Restart_gitea - Restart_gitea
- name: Start and enable Gitea - name: Start and enable Gitea
ansible.builtin.systemd_service: ansible.builtin.systemd_service:
name: gitea.service name: gitea.service

View File

@@ -13,6 +13,7 @@
--host {{ gitea_domain }},{{ gitea_ssh_domain }} --host {{ gitea_domain }},{{ gitea_ssh_domain }}
--out /var/lib/gitea/certs/cert.pem --out /var/lib/gitea/certs/cert.pem
--keyout /var/lib/gitea/certs/key.pem --keyout /var/lib/gitea/certs/key.pem
become: true
become_user: "{{ gitea_user }}" become_user: "{{ gitea_user }}"
args: args:
creates: /var/lib/gitea/certs/cert.pem creates: /var/lib/gitea/certs/cert.pem