roles/gitea: Install from upstream binary

I seem to have forgotten how I got the RPM for Gitea.  I think I built
it, but I cannot find the spec file, nor the RPM package.  Since this is
clearly not reproducible, I decided to switch to using the binary
provided by upstream for now, until either I or Fedora get around to
making a better RPM.

Installing Gitea from the upstream binary is simple: just download it
and copy it to `/usr/local/bin`.  Of course, the OS user and systemd
unit have to be managed by configuration policy when it's installed this
way.
jenkins-master
Dustin 2020-02-22 16:19:45 -06:00
parent 2bc2ea65ac
commit f8b7f28469
6 changed files with 79 additions and 3 deletions

View File

@ -1,3 +1,11 @@
gitea_version: 1.11.0
gitea_arch: '{{ _gitea_arch_map[ansible_architecture] }}'
gitea_bin: gitea-{{ gitea_version }}-linux-{{ gitea_arch }}
gitea_bin_sha256: >-
d4df5f456cf13d49c096525ff762ad70386251d3f0d2805735b5dfade17e88d4
gitea_download_url: >-
https://dl.gitea.io/gitea/{{ gitea_version }}/{{ gitea_bin }}
gitea_ssh_domain: '{{ ansible_fqdn }}' gitea_ssh_domain: '{{ ansible_fqdn }}'
gitea_http_domain: '{{ gitea_ssh_domain }}' gitea_http_domain: '{{ gitea_ssh_domain }}'
gitea_root_url: 'http://{{ gitea_http_domain }}:3000/' gitea_root_url: 'http://{{ gitea_http_domain }}:3000/'

1
roles/gitea/files/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
gitea-*-linux-*

View File

@ -0,0 +1,13 @@
[Unit]
Description=Gitea - Git with a cup of tea
[Service]
Type=simple
User=gitea
Environment=GITEA_CONFIG=/etc/gitea/app.ini
Environment=HOME=/var/lib/gitea
EnvironmentFile=-/etc/sysconfig/gitea
ExecStart=/usr/local/bin/gitea web -c ${GITEA_CONFIG}
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,6 @@
- name: reload systemd
command:
systemctl daemon-reload
- name: reload httpd - name: reload httpd
service: service:
name=httpd name=httpd

View File

@ -1,13 +1,59 @@
- name: load gitea secrets - name: load gitea secrets
include_vars: vault/gitea include_vars: vault/gitea
- name: ensure gitea system group exists
group:
name: gitea
system: yes
tags:
- user
- group
- name: ensure gitea system user exists
user:
name: gitea
group: gitea
system: yes
home: /var/lib/gitea
createhome: no
tags:
- user
- name: ensure gitea data directory exists
file:
path: /var/lib/gitea
mode: '0700'
owner: gitea
group: gitea
- name: download gitea binary
become: false
delegate_to: localhost
get_url:
url: '{{ gitea_download_url }}'
dest: 'roles/gitea/files/{{ gitea_bin }}'
checksum: 'sha256:{{ gitea_bin_sha256 }}'
tags:
- download
- name: ensure gitea is installed - name: ensure gitea is installed
package: copy:
name=gitea src: '{{ gitea_bin }}'
state=present dest: /usr/local/bin/gitea
mode: '0755'
diff: false
notify:
- restart gitea
tags: tags:
- install - install
- name: ensure gitea systemd unit is installed
copy:
src: gitea.service
dest: /etc/systemd/system/gitea.service
mode: '0644'
notify:
- reload systemd
- restart gitea
- name: ensure gitea is configured - name: ensure gitea is configured
template: template:
src=app.ini.j2 src=app.ini.j2

View File

@ -0,0 +1,5 @@
_gitea_arch_map:
i686: 386
x86_64: amd64
aarch64: arm64
armv7l: arm