From ba2770c69679c1bd90992fa03f14bec3f16371c7 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Thu, 6 Mar 2025 19:29:39 +0000 Subject: [PATCH] Remove obsolete gitea roles --- roles/gitea/defaults/main.yml | 6 -- roles/gitea/files/gitea.service | 16 ---- roles/gitea/handlers/main.yml | 5 - roles/gitea/meta/main.yml | 4 - roles/gitea/tasks/main.yml | 101 -------------------- roles/gitea/templates/app.ini.j2 | 80 ---------------- roles/gitea_runner/defaults/main.yml | 2 - roles/gitea_runner/files/act_runner.service | 14 --- roles/gitea_runner/files/config.yml | 50 ---------- roles/gitea_runner/handlers/main.yml | 5 - roles/gitea_runner/meta/main.yml | 4 - roles/gitea_runner/tasks/main.yml | 85 ---------------- 12 files changed, 372 deletions(-) delete mode 100644 roles/gitea/defaults/main.yml delete mode 100644 roles/gitea/files/gitea.service delete mode 100644 roles/gitea/handlers/main.yml delete mode 100644 roles/gitea/meta/main.yml delete mode 100644 roles/gitea/tasks/main.yml delete mode 100644 roles/gitea/templates/app.ini.j2 delete mode 100644 roles/gitea_runner/defaults/main.yml delete mode 100644 roles/gitea_runner/files/act_runner.service delete mode 100644 roles/gitea_runner/files/config.yml delete mode 100644 roles/gitea_runner/handlers/main.yml delete mode 100644 roles/gitea_runner/meta/main.yml delete mode 100644 roles/gitea_runner/tasks/main.yml diff --git a/roles/gitea/defaults/main.yml b/roles/gitea/defaults/main.yml deleted file mode 100644 index 8581431..0000000 --- a/roles/gitea/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -gitea_url: >- - {{ - "https://dl.gitea.com/gitea/" + gitea_version + "/gitea-" + - gitea_version + "-" + ansible_system | lower + "-amd64" - }} diff --git a/roles/gitea/files/gitea.service b/roles/gitea/files/gitea.service deleted file mode 100644 index 0dfec4a..0000000 --- a/roles/gitea/files/gitea.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Gitea (Git with a cup of tea) -After=syslog.target -After=network.target - -[Service] -Type=simple -User=gitea -Group=gitea -WorkingDirectory=/srv/gitea -ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini -Restart=always -Environment=HOME=/srv/gitea GITEA_WORK_DIR=/srv/gitea - -[Install] -WantedBy=multi-user.target diff --git a/roles/gitea/handlers/main.yml b/roles/gitea/handlers/main.yml deleted file mode 100644 index a8e19c4..0000000 --- a/roles/gitea/handlers/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Restart gitea - ansible.builtin.service: - name: gitea - state: restarted diff --git a/roles/gitea/meta/main.yml b/roles/gitea/meta/main.yml deleted file mode 100644 index d5e8ce4..0000000 --- a/roles/gitea/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -dependencies: - - {role: git} - - {role: nginx} diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml deleted file mode 100644 index 2eafa5e..0000000 --- a/roles/gitea/tasks/main.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- -- name: Download binary - ansible.builtin.get_url: - url: "{{ gitea_url }}" - checksum: "sha256:{{ gitea_url }}.sha256" - dest: /usr/local/bin/gitea - mode: "0755" - owner: root - group: "{{ ansible_wheel }}" - notify: Restart gitea - -- name: Create group - ansible.builtin.group: - name: gitea - gid: 303 - -- name: Create user - ansible.builtin.user: - name: gitea - comment: Service Gitea - createhome: false - group: gitea - home: /var/empty - shell: /sbin/nologin - uid: 303 - -- name: Create config directory - ansible.builtin.file: - path: /etc/gitea - state: directory - mode: "0750" - owner: root - group: gitea - -- name: Create config - ansible.builtin.template: - dest: /etc/gitea/app.ini - src: app.ini.j2 - mode: "0640" - owner: root - group: gitea - notify: Restart gitea - -- name: Create data directory - ansible.builtin.file: - path: /export/gitea - state: directory - mode: "0750" - owner: gitea - group: gitea - -- name: Link data directory - ansible.builtin.file: - path: /srv/gitea - state: link - src: /export/gitea - owner: root - group: "{{ ansible_wheel }}" - follow: false - -- name: Create service file - ansible.builtin.copy: - dest: /etc/systemd/system/gitea.service - src: gitea.service - mode: "0644" - owner: root - group: "{{ ansible_wheel }}" - notify: Restart gitea - -- name: Enable service - ansible.builtin.service: - name: gitea - state: started - enabled: true - -- name: Allow nginx to connect gitea - ansible.posix.seboolean: - name: httpd_can_network_connect - state: true - persistent: true - -- name: Copy nginx config - ansible.builtin.copy: - dest: "/etc/nginx/conf.d/{{ inventory_hostname }}/gitea.conf" - content: | - client_max_body_size 100m; - location / { - proxy_pass http://127.0.0.1:3000; - } - mode: "0644" - owner: root - group: "{{ ansible_wheel }}" - notify: Restart nginx - -- name: Add gitea alias for root - ansible.builtin.blockinfile: - path: /root/.bashrc - block: | - # run gitea as gitea user - alias gitea='sudo -u gitea HOME=/srv/gitea GITEA_WORK_DIR=/srv/gitea \ - /usr/local/bin/gitea -c /etc/gitea/app.ini' diff --git a/roles/gitea/templates/app.ini.j2 b/roles/gitea/templates/app.ini.j2 deleted file mode 100644 index 3a797b9..0000000 --- a/roles/gitea/templates/app.ini.j2 +++ /dev/null @@ -1,80 +0,0 @@ -APP_NAME = foo.sh - GIT -RUN_USER = gitea -RUN_MODE = prod - -[database] -DB_TYPE = mysql -HOST = sqldb02.home.foo.sh -NAME = gitea -USER = gitea -PASSWD = {{ gitea_mysql_pass }} -SCHEMA = -SSL_MODE = true -CHARSET = utf8 -PATH = /srv/gitea/data/gitea.db -LOG_SQL = false - -[repository] -ROOT = /srv/gitea/data/gitea-repositories - -[server] -SSH_DOMAIN = localhost -DOMAIN = git.foo.sh -HTTP_ADDR = 127.0.0.1 -HTTP_PORT = 3000 -ROOT_URL = https://git.foo.sh/ -DISABLE_SSH = true -SSH_PORT = 22 -LFS_START_SERVER = true -LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} -OFFLINE_MODE = false - -[lfs] -PATH = /srv/gitea/data/lfs - -[mailer] -ENABLED = false - -[service] -REGISTER_EMAIL_CONFIRM = false -ENABLE_NOTIFY_MAIL = false -DISABLE_REGISTRATION = true -ALLOW_ONLY_EXTERNAL_REGISTRATION = false -ENABLE_CAPTCHA = false -REQUIRE_SIGNIN_VIEW = false -DEFAULT_KEEP_EMAIL_PRIVATE = false -DEFAULT_ALLOW_CREATE_ORGANIZATION = true -DEFAULT_ENABLE_TIMETRACKING = true -NO_REPLY_ADDRESS = noreply.localhost - -[openid] -ENABLE_OPENID_SIGNIN = false -ENABLE_OPENID_SIGNUP = false - -[session] -PROVIDER = file - -[log] -MODE = console -LEVEL = info -ROOT_PATH = /srv/gitea/log -ROUTER = console - -[repository.pull-request] -DEFAULT_MERGE_STYLE = merge - -[repository.signing] -DEFAULT_TRUST_MODEL = committer - -[security] -INSTALL_LOCK = true -INTERNAL_TOKEN = {{ gitea_internal_token }} -PASSWORD_HASH_ALGO = pbkdf2 -REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128 -REVERSE_PROXY_LIMIT = 1 - -[actions] -ENABLED = true - -[oauth2] -JWT_SECRET = {{ gitea_oauth_jwt_secret }} diff --git a/roles/gitea_runner/defaults/main.yml b/roles/gitea_runner/defaults/main.yml deleted file mode 100644 index bb9e11e..0000000 --- a/roles/gitea_runner/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -gitea_runner_version: main diff --git a/roles/gitea_runner/files/act_runner.service b/roles/gitea_runner/files/act_runner.service deleted file mode 100644 index 1533c88..0000000 --- a/roles/gitea_runner/files/act_runner.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Act Runner for Gitea -After=syslog.target -After=network.target - -[Service] -User=act_runner -Group=act_runner -WorkingDirectory=/var/lib/act_runner -Environment=HOME=/var/lib/act_runner -ExecStart=/usr/local/bin/act_runner daemon -c /var/lib/act_runner/config.yml - -[Install] -WantedBy=multi-user.target diff --git a/roles/gitea_runner/files/config.yml b/roles/gitea_runner/files/config.yml deleted file mode 100644 index 641665f..0000000 --- a/roles/gitea_runner/files/config.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- -log: - # The level of logging, can be trace, debug, info, warn, error, fatal - level: info - -runner: - # Where to store the registration result. - file: .runner - # Execute how many tasks concurrently at the same time. - capacity: 1 - # Extra environment variables to run jobs from a file. - # It will be ignored if it's empty or the file doesn't exist. - env_file: .env - # The timeout for a job to be finished. - # Please note that the Gitea instance also has a timeout (3h by default) - # for the job. So the job could be stopped by the Gitea instance if it's - # timeout is shorter than this. - timeout: 3h - # Whether skip verifying the TLS certificate of the Gitea instance. - insecure: false - # The timeout for fetching the job from the Gitea instance. - fetch_timeout: 5s - # The interval for fetching the job from the Gitea instance. - fetch_interval: 2s - -cache: - # Enable cache server to use actions/cache. - enabled: true - # The directory to store the cache data. - # If it's empty, the cache data will be stored in $HOME/.cache/actcache. - dir: "" - # The host of the cache server. - # It's not for the address to listen, but the address to connect from job - # containers. So 0.0.0.0 is a bad choice, leave it empty to detect - # automatically. - host: "" - # The port of the cache server. - # 0 means to use a random available port. - port: 0 - -container: - # Which network to use for the job containers. Could be bridge, host, none, - # or the name of a custom network. - network: bridge - # Whether to use privileged mode or not when launching task containers - # (privileged mode is required for Docker-in-Docker). - privileged: false - # And other options to be used when the container is started - # (eg, --add-host=my.gitea.url:host-gateway). - options: diff --git a/roles/gitea_runner/handlers/main.yml b/roles/gitea_runner/handlers/main.yml deleted file mode 100644 index 3f4dbfd..0000000 --- a/roles/gitea_runner/handlers/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Restart act_runner - ansible.builtin.service: - name: act_runner - state: restarted diff --git a/roles/gitea_runner/meta/main.yml b/roles/gitea_runner/meta/main.yml deleted file mode 100644 index 4dfd1ac..0000000 --- a/roles/gitea_runner/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -dependencies: - - {role: docker} - - {role: git} diff --git a/roles/gitea_runner/tasks/main.yml b/roles/gitea_runner/tasks/main.yml deleted file mode 100644 index d8eac04..0000000 --- a/roles/gitea_runner/tasks/main.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -- name: Create group - ansible.builtin.group: - name: act_runner - system: true - -- name: Create user - ansible.builtin.user: - name: act_runner - system: true - comment: Gitea act_runner - create_home: false - home: /var/empty - group: act_runner - groups: - - docker - shell: /sbin/nologin - -- name: Install dependencies - ansible.builtin.package: - name: golang - state: installed - -- name: Download binary - ansible.builtin.get_url: - url: > - {{ - "https://gitea.com/gitea/act_runner/releases/download/v" + - gitea_runner_version + "/act_runner-" + gitea_runner_version + - "-" + ansible_system | lower + "-amd64" - }} - dest: /usr/local/bin/act_runner - mode: "0755" - owner: root - group: "{{ ansible_wheel }}" - notify: Restart act_runner - -- name: Create config directory - ansible.builtin.file: - path: /var/lib/act_runner - state: directory - mode: "0750" - owner: root - group: act_runner - -- name: Copy config file - ansible.builtin.copy: - dest: /var/lib/act_runner/.runner - src: "/srv/private/files/act_runner/{{ inventory_hostname }}.conf" - mode: "0640" - owner: root - group: act_runner - notify: Restart act_runner - -- name: Copy config file - ansible.builtin.copy: - dest: /var/lib/act_runner/config.yml - src: config.yml - mode: "0640" - owner: root - group: act_runner - notify: Restart act_runner - -- name: Create cache directory - ansible.builtin.file: - path: /var/lib/act_runner/.cache - state: directory - mode: "0770" - owner: root - group: act_runner - notify: Restart act_runner - -- name: Copy unit file - ansible.builtin.copy: - dest: /etc/systemd/system/act_runner.service - src: act_runner.service - mode: "0644" - owner: root - group: root - -- name: Enable service - ansible.builtin.service: - name: act_runner - state: started - enabled: true