From d90ab6316d2c946d53eff86d1db2b121dce68ddb Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Sun, 22 Dec 2024 19:26:29 -0700 Subject: [PATCH] Adjust based on test run --- .../public/assets/img/apple-touch-icon.png | Bin .../custom/public/assets/img/favicon.png | Bin .../custom/public/assets/img/favicon.svg | 0 .../custom/public/assets/img/logo.png | Bin .../custom/public/assets/img/logo.svg | 0 .../custom/public/css/theme-carbonred.css | 0 .../custom/public/css/theme-darkred.css | 0 .../custom/public/css/theme-earl-grey.css | 0 .../custom/public/css/theme-gitea-blue.css | 0 .../custom/public/css/theme-gitea-modern.css | 0 .../custom/public/css/theme-pitchblack.css | 0 .../custom/templates/user/auth/signup.tmpl | 0 defaults/main.yml => group_vars/all.yml | 4 ++++ handlers/main.yml | 4 ++-- hosts | 1 + role-forgejo.yml | 3 +++ tasks/forgejo/install.yml | 2 +- templates/config/tea/config.yml | 8 ++++---- templates/etc/forgejo/conf/app.ini.j2 | 11 ++++++----- .../conf.d/{gitea.conf.j2 => forgejo.conf.j2} | 16 ++++++++-------- vars/common.yml | 11 ++++++----- vars/db.yml | 16 ++++++++-------- 22 files changed, 43 insertions(+), 33 deletions(-) rename files/var/lib/{gitea => forgejo}/custom/public/assets/img/apple-touch-icon.png (100%) rename files/var/lib/{gitea => forgejo}/custom/public/assets/img/favicon.png (100%) rename files/var/lib/{gitea => forgejo}/custom/public/assets/img/favicon.svg (100%) rename files/var/lib/{gitea => forgejo}/custom/public/assets/img/logo.png (100%) rename files/var/lib/{gitea => forgejo}/custom/public/assets/img/logo.svg (100%) rename files/var/lib/{gitea => forgejo}/custom/public/css/theme-carbonred.css (100%) rename files/var/lib/{gitea => forgejo}/custom/public/css/theme-darkred.css (100%) rename files/var/lib/{gitea => forgejo}/custom/public/css/theme-earl-grey.css (100%) rename files/var/lib/{gitea => forgejo}/custom/public/css/theme-gitea-blue.css (100%) rename files/var/lib/{gitea => forgejo}/custom/public/css/theme-gitea-modern.css (100%) rename files/var/lib/{gitea => forgejo}/custom/public/css/theme-pitchblack.css (100%) rename files/var/lib/{gitea => forgejo}/custom/templates/user/auth/signup.tmpl (100%) rename defaults/main.yml => group_vars/all.yml (83%) create mode 100644 hosts rename templates/etc/httpd/conf.d/{gitea.conf.j2 => forgejo.conf.j2} (60%) diff --git a/files/var/lib/gitea/custom/public/assets/img/apple-touch-icon.png b/files/var/lib/forgejo/custom/public/assets/img/apple-touch-icon.png similarity index 100% rename from files/var/lib/gitea/custom/public/assets/img/apple-touch-icon.png rename to files/var/lib/forgejo/custom/public/assets/img/apple-touch-icon.png diff --git a/files/var/lib/gitea/custom/public/assets/img/favicon.png b/files/var/lib/forgejo/custom/public/assets/img/favicon.png similarity index 100% rename from files/var/lib/gitea/custom/public/assets/img/favicon.png rename to files/var/lib/forgejo/custom/public/assets/img/favicon.png diff --git a/files/var/lib/gitea/custom/public/assets/img/favicon.svg b/files/var/lib/forgejo/custom/public/assets/img/favicon.svg similarity index 100% rename from files/var/lib/gitea/custom/public/assets/img/favicon.svg rename to files/var/lib/forgejo/custom/public/assets/img/favicon.svg diff --git a/files/var/lib/gitea/custom/public/assets/img/logo.png b/files/var/lib/forgejo/custom/public/assets/img/logo.png similarity index 100% rename from files/var/lib/gitea/custom/public/assets/img/logo.png rename to files/var/lib/forgejo/custom/public/assets/img/logo.png diff --git a/files/var/lib/gitea/custom/public/assets/img/logo.svg b/files/var/lib/forgejo/custom/public/assets/img/logo.svg similarity index 100% rename from files/var/lib/gitea/custom/public/assets/img/logo.svg rename to files/var/lib/forgejo/custom/public/assets/img/logo.svg diff --git a/files/var/lib/gitea/custom/public/css/theme-carbonred.css b/files/var/lib/forgejo/custom/public/css/theme-carbonred.css similarity index 100% rename from files/var/lib/gitea/custom/public/css/theme-carbonred.css rename to files/var/lib/forgejo/custom/public/css/theme-carbonred.css diff --git a/files/var/lib/gitea/custom/public/css/theme-darkred.css b/files/var/lib/forgejo/custom/public/css/theme-darkred.css similarity index 100% rename from files/var/lib/gitea/custom/public/css/theme-darkred.css rename to files/var/lib/forgejo/custom/public/css/theme-darkred.css diff --git a/files/var/lib/gitea/custom/public/css/theme-earl-grey.css b/files/var/lib/forgejo/custom/public/css/theme-earl-grey.css similarity index 100% rename from files/var/lib/gitea/custom/public/css/theme-earl-grey.css rename to files/var/lib/forgejo/custom/public/css/theme-earl-grey.css diff --git a/files/var/lib/gitea/custom/public/css/theme-gitea-blue.css b/files/var/lib/forgejo/custom/public/css/theme-gitea-blue.css similarity index 100% rename from files/var/lib/gitea/custom/public/css/theme-gitea-blue.css rename to files/var/lib/forgejo/custom/public/css/theme-gitea-blue.css diff --git a/files/var/lib/gitea/custom/public/css/theme-gitea-modern.css b/files/var/lib/forgejo/custom/public/css/theme-gitea-modern.css similarity index 100% rename from files/var/lib/gitea/custom/public/css/theme-gitea-modern.css rename to files/var/lib/forgejo/custom/public/css/theme-gitea-modern.css diff --git a/files/var/lib/gitea/custom/public/css/theme-pitchblack.css b/files/var/lib/forgejo/custom/public/css/theme-pitchblack.css similarity index 100% rename from files/var/lib/gitea/custom/public/css/theme-pitchblack.css rename to files/var/lib/forgejo/custom/public/css/theme-pitchblack.css diff --git a/files/var/lib/gitea/custom/templates/user/auth/signup.tmpl b/files/var/lib/forgejo/custom/templates/user/auth/signup.tmpl similarity index 100% rename from files/var/lib/gitea/custom/templates/user/auth/signup.tmpl rename to files/var/lib/forgejo/custom/templates/user/auth/signup.tmpl diff --git a/defaults/main.yml b/group_vars/all.yml similarity index 83% rename from defaults/main.yml rename to group_vars/all.yml index 8dee0dd..1112692 100644 --- a/defaults/main.yml +++ b/group_vars/all.yml @@ -1,5 +1,6 @@ --- # Defaults +# Set adjustments in another group vars file or via extra vars forgejo_version: "9.0.3" forgejo_arch: "amd64" forgejo_web_install: "httpd" @@ -24,6 +25,9 @@ forgejo_directory_list: - "/var/lib/forgejo/custom" - "/var/lib/forgejo/custom/https" - "/var/lib/forgejo/custom/mailer" + - "/var/lib/forgejo/custom/templates" + - "/var/lib/forgejo/custom/templates/user" + - "/var/lib/forgejo/custom/templates/user/auth" - "/var/lib/forgejo/data" - "/var/lib/forgejo/log" ... diff --git a/handlers/main.yml b/handlers/main.yml index d10821b..a219d1f 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,8 +1,8 @@ --- # Handlers -- name: restart_gitea +- name: restart_forgejo service: - name: gitea + name: forgejo state: restarted - name: restart_httpd diff --git a/hosts b/hosts new file mode 100644 index 0000000..7e518e6 --- /dev/null +++ b/hosts @@ -0,0 +1 @@ +idp.angelsofclockwork.net diff --git a/role-forgejo.yml b/role-forgejo.yml index 15e503a..2656e72 100644 --- a/role-forgejo.yml +++ b/role-forgejo.yml @@ -8,6 +8,9 @@ - "vars/common.yml" - "vars/db.yml" + handlers: + - import_tasks: handlers/main.yml + pre_tasks: - name: Check if ansible cannot be run here stat: diff --git a/tasks/forgejo/install.yml b/tasks/forgejo/install.yml index c1209ac..bc5a578 100644 --- a/tasks/forgejo/install.yml +++ b/tasks/forgejo/install.yml @@ -20,7 +20,7 @@ - name: "Get Forgejo binary" ansible.builtin.get_url: url: "https://codeberg.org/forgejo/forgejo/releases/download/v{{ forgejo_version }}/forgejo-{{ forgejo_version }}-linux-{{ forgejo_arch }}" - dest: "/usr/local/bin/{{ forgejo_binary_name }}" + dest: "/usr/local/bin/forgejo-{{ forgejo_version }}-linux-{{ forgejo_arch }}" checksum: "sha256:{{ forgejo_sha_verif }}" mode: "0755" register: forgejo_content diff --git a/templates/config/tea/config.yml b/templates/config/tea/config.yml index d68175c..92cdd2e 100644 --- a/templates/config/tea/config.yml +++ b/templates/config/tea/config.yml @@ -1,8 +1,8 @@ logins: -- name: "{{ gitea_basename }}" - url: "https://{{ gitea_basename }}" - token: "{{ gitea_token }}" +- name: "{{ forgejo_basename }}" + url: "https://{{ forgejo_basename }}" + token: "{{ forgejo_token }}" default: true insecure: false - user: "{{ gitea_automation_user }}" + user: "{{ forgejo_automation_user }}" created: 1644820631 diff --git a/templates/etc/forgejo/conf/app.ini.j2 b/templates/etc/forgejo/conf/app.ini.j2 index 8b1ec13..4f8f783 100644 --- a/templates/etc/forgejo/conf/app.ini.j2 +++ b/templates/etc/forgejo/conf/app.ini.j2 @@ -4,13 +4,14 @@ RUN_MODE = prod WORK_PATH = /var/lib/forgejo [database] -DB_TYPE = postgres -HOST = {{ forgejo_database_host }} -NAME = {{ forgejo_database_name }} -USER = {{ forgejo_database_user }} -PASSWD = {{ forgejo_database_pass }} +DB_TYPE = sqlite +HOST = {{ forgejo_database_host|default('127.0.0.1:3306') }} +NAME = {{ forgejo_database_name|default('forgejo') }} +USER = {{ forgejo_database_user|default('forgejo') }} +PASSWD = {{ forgejo_database_pass|default('') }} SCHEMA = SSL_MODE = {{ forgejo_database_ssl|default('disabled') }} +PATH = /var/lib/gitea/data/gitea.db CHARSET = utf8 LOG_SQL = false diff --git a/templates/etc/httpd/conf.d/gitea.conf.j2 b/templates/etc/httpd/conf.d/forgejo.conf.j2 similarity index 60% rename from templates/etc/httpd/conf.d/gitea.conf.j2 rename to templates/etc/httpd/conf.d/forgejo.conf.j2 index e966ee8..49269c6 100644 --- a/templates/etc/httpd/conf.d/gitea.conf.j2 +++ b/templates/etc/httpd/conf.d/forgejo.conf.j2 @@ -1,19 +1,19 @@ - ServerName {{ gitea_basename }} - ServerAlias {{ gitea_basename }} + ServerName {{ forgejo_basename }} + ServerAlias {{ forgejo_basename }} ProxyPreserveHost On ProxyRequests Off AllowEncodedSlashes NoDecode ProxyPass / http://localhost:3000/ nocanon ProxyPassReverse / http://localhost:3000/ nocanon - ServerAdmin {{ gitea_server_admin }} + ServerAdmin {{ forgejo_server_admin }} Protocols h2 http/1.1 SSLEngine On - ServerName {{ gitea_basename }} - ServerAlias {{ gitea_basename }} + ServerName {{ forgejo_basename }} + ServerAlias {{ forgejo_basename }} ProxyPreserveHost On ProxyRequests Off AllowEncodedSlashes NoDecode @@ -24,7 +24,7 @@ SSLHonorCipherOrder on SSLCipherSuite PROFILE=SYSTEM SSLProxyCipherSuite PROFILE=SYSTEM - SSLCertificateFile /etc/pki/tls/certs/{{ gitea_basename }}.crt - SSLCertificateKeyFile /etc/pki/tls/private/{{ gitea_basename }}.key - ServerAdmin {{ gitea_server_admin }} + SSLCertificateFile /etc/pki/tls/certs/{{ forgejo_basename }}.crt + SSLCertificateKeyFile /etc/pki/tls/private/{{ forgejo_basename }}.key + ServerAdmin {{ forgejo_server_admin }} diff --git a/vars/common.yml b/vars/common.yml index 431625a..341eafc 100644 --- a/vars/common.yml +++ b/vars/common.yml @@ -1,12 +1,13 @@ --- -gitea_web_username: "{% if gitea_web_install == 'httpd' %}apache{% else %}{{ gitea_web_install }}{% endif %}" +forgejo_web_username: "{% if forgejo_web_install == 'httpd' %}apache{% else %}{{ forgejo_web_install }}{% endif %}" +forgejo_packages: True # Certs issued by FreeIPA Only ipa_getcert_requested_hostnames: - name: "{{ ansible_fqdn }}" - owner: "{{ gitea_web_username }}" - key_location: "/etc/pki/tls/private/{{ gitea_basename }}.key" - cert_location: "/etc/pki/tls/certs/{{ gitea_basename }}.crt" + owner: "{{ forgejo_web_username }}" + key_location: "/etc/pki/tls/private/{{ forgejo_basename }}.key" + cert_location: "/etc/pki/tls/certs/{{ forgejo_basename }}.crt" postcmd: "/bin/systemctl reload httpd" cnames: - - "{{ gitea_basename }}" + - "{{ forgejo_basename }}" ... diff --git a/vars/db.yml b/vars/db.yml index a898e03..e9daba9 100644 --- a/vars/db.yml +++ b/vars/db.yml @@ -1,10 +1,10 @@ --- -gitea_db: "{{ gitea_db_type|default('sqlite3') }}" -gitea_db_user: "{{ gitea_db_username|default('gitea') }}" -gitea_db_pass: "{{ gitea_db_password|default('') }}" -gitea_db_host: "{{ gitea_db_host|default('127.0.0.1:3306') }}" -gitea_db_name: "{{ gitea_db_name|default('gitea') }}" -gitea_db_ssl: "{{ gitea_db_ssl_mode|default('disable') }}" -gitea_db_schema: "{{ gitea_db_schema_type|default('') }}" -gitea_db_path: "/var/lib/gitea/data/gitea.db" +forgejo_db: "{{ forgejo_db_type|default('sqlite3') }}" +forgejo_db_user: "{{ forgejo_db_username|default('gitea') }}" +forgejo_db_pass: "{{ forgejo_db_password|default('') }}" +forgejo_db_host: "{{ forgejo_db_host|default('127.0.0.1:3306') }}" +forgejo_db_name: "{{ forgejo_db_name|default('gitea') }}" +forgejo_db_ssl: "{{ forgejo_db_ssl_mode|default('disable') }}" +forgejo_db_schema: "{{ forgejo_db_schema_type|default('') }}" +forgejo_db_path: "/var/lib/gitea/data/gitea.db" ...