ansible/roles/gogs/tasks/main.yml

45 lines
1.3 KiB
YAML
Raw 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
apt_key: url='https://dl.packager.io/srv/pkgr/gogs/key'
2016-04-09 23:41:41 +02:00
- name: Enable gogs repository
2018-05-08 23:15:06 +02:00
apt_repository: repo="deb https://dl.packager.io/srv/deb/pkgr/gogs/pkgr/debian 9 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 }}
2016-04-09 23:41:41 +02:00
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