1
0
forked from infra/ansible
infra/roles/gogs/tasks/main.yml

46 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2016-04-09 23:41:41 +02:00
---
- name: Enable https for apt
2017-07-02 22:17:32 +02:00
apt: name=apt-transport-https
2016-04-09 23:41:41 +02:00
- name: Enable gogs apt-key
2019-07-23 12:00:59 +02:00
apt_key: url="https://dl.packager.io/srv/pkgr/gogs/key"
2016-04-09 23:41:41 +02:00
- name: Enable gogs repository
2019-08-30 11:20:40 +02:00
apt_repository: repo="deb https://dl.packager.io/srv/deb/gogs/gogs/master/debian 10 main"
2016-04-09 23:41:41 +02:00
- name: Install gogs
2018-04-22 12:09:14 +02:00
apt: name=gogs
2016-04-09 23:41:41 +02:00
- name: Install PostgreSQL
2017-07-02 22:17:32 +02:00
apt: name={{ item }}
loop:
2016-04-09 23:41:41 +02:00
- postgresql
- python-psycopg2
- name: Configure PostgreSQL database
postgresql_db: name={{ gogs_dbname }}
become: true
become_user: postgres
- name: Configure PostgreSQL user
postgresql_user: db={{ gogs_dbname }} name={{ gogs_dbuser }} password={{ gogs_dbpass }} priv=ALL state=present
become: true
become_user: postgres
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ gogs_domain }}.key -out /etc/nginx/ssl/{{ gogs_domain }}.crt -days 730 -subj "/CN={{ gogs_domain }}" creates=/etc/nginx/ssl/{{ gogs_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager for gogs
2019-05-20 19:49:08 +02:00
template: src=certs.j2 dest=/etc/acertmgr/{{ gogs_domain }}.conf
notify: Run acertmgr
2016-04-09 23:41:41 +02:00
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/gogs
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/gogs dest=/etc/nginx/sites-enabled/gogs state=link
notify: Restart nginx