The *gitea* role installs Gitea using the system package manager and
configures Apache as a reverse proxy for it.
The configuration file requires a number of "secret" values that need to
be unique. These must be specified as Ansible variables:
* `gitea_internal_token`
* `gitea_secret_key`
* `gitea_lfs_jwt_secret`
The `gitea generate` command can be used to create these values.
Normally, Gitea expects to run its own setup tool to generate the
configuration file and create the administrative user. Since the
configuration file is generated from the template instead, no
administrative user is created automatically. Luckily, the `gitea`
command includes a tool to create users, so the administrator can be
created manually, e.g.:
sudo -u gitea gitea admin create-user -c /etc/gitea/app.ini \
--admin
--name giteadmin \
--password giteadmin \
--email giteadmin@example.org
36 lines
660 B
YAML
36 lines
660 B
YAML
- name: load gitea secrets
|
|
include_vars: vault/gitea
|
|
|
|
- name: ensure gitea is installed
|
|
package:
|
|
name=gitea
|
|
state=present
|
|
tags:
|
|
- install
|
|
|
|
- name: ensure gitea is configured
|
|
template:
|
|
src=app.ini.j2
|
|
dest=/etc/gitea/app.ini
|
|
mode=0640
|
|
owner=root
|
|
group=gitea
|
|
notify: restart gitea
|
|
|
|
- meta: flush_handlers
|
|
- name: ensure gitea is running
|
|
service:
|
|
name=gitea
|
|
state=started
|
|
- name: ensure gitea starts at boot
|
|
service:
|
|
name=gitea
|
|
enabled=yes
|
|
|
|
- name: ensure apache is configured to proxy for gitea
|
|
copy:
|
|
src=gitea.httpd.conf
|
|
dest=/etc/httpd/conf.d/gitea.conf
|
|
mode=0644
|
|
notify: reload httpd
|