roles/gitea: installing gitea is now idempotent

This commit is contained in:
CPunch 2023-01-19 15:11:22 -06:00
parent 2d3fbfe484
commit e3d3ec37fd
2 changed files with 21 additions and 14 deletions

View File

@ -1,17 +1,4 @@
---
# TODO: make idempotent
- name: Add Gitea repo key
shell: curl -s https://packaging.gitlab.io/gitea/gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/morph027-gitea.gpg --import
# TODO: make idempotent
- name: Set key perms
shell: sudo chmod 644 /etc/apt/trusted.gpg.d/morph027-gitea.gpg
- name: Add Gitea repo
apt_repository:
filename: morph027-gitea
repo: deb https://packaging.gitlab.io/gitea gitea main
- name: Upgrade Packages
apt:
update_cache: yes
@ -21,7 +8,6 @@
package:
name:
- hugo
- gitea
- git
- nginx
- tor

View File

@ -1,4 +1,25 @@
---
- name: Check for Gitea gpg key
stat:
path: /etc/apt/trusted.gpg.d/morph027-gitea.gpg
register: gitea_key
- name: Add Gitea key && repository
block:
- name: Import Gitea key
shell: curl -s https://packaging.gitlab.io/gitea/gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/morph027-gitea.gpg --import && sudo chmod 644 /etc/apt/trusted.gpg.d/morph027-gitea.gpg
- name: Add Gitea repository
apt_repository:
filename: morph027-gitea
repo: deb https://packaging.gitlab.io/gitea gitea main
when: gitea_key.stat.exists == false or gitea_key.stat.mode != "0644"
- name: Install Gitea
package:
name:
- gitea
- name: Configure Gitea
template:
src: app.ini