45 lines
1.4 KiB
YAML
45 lines
1.4 KiB
YAML
---
|
|
|
|
- name: Enable https for apt
|
|
apt: name=apt-transport-https state=present
|
|
|
|
- name: Enable gogs apt-key
|
|
apt_key: url='https://deb.packager.io/key'
|
|
|
|
- name: Enable gogs repository
|
|
apt_repository: repo='deb https://deb.packager.io/gh/pkgr/gogs jessie pkgr'
|
|
|
|
- name: Install gogs
|
|
apt: name=gogs state=latest
|
|
|
|
- name: Install PostgreSQL
|
|
apt: name={{ item }} state=present
|
|
with_items:
|
|
- 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
|
|
template: src=certs.j2 dest=/etc/acme/domains.d/{{ gogs_domain }}.conf
|
|
|
|
- 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
|