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

88 lines
2.4 KiB
YAML

---
- name: Enable https for apt
apt: name=apt-transport-https
- name: Enable sury php apt-key
apt_key: url="https://packages.sury.org/php/apt.gpg"
- name: Enable sury php repository
apt_repository: repo="deb https://packages.sury.org/php/ stretch main"
- name: Install packages
apt:
name:
- php-redis
- php7.4
- php7.4-bcmath
- php7.4-bz2
- php7.4-cli
- php7.4-common
- php7.4-curl
- php7.4-dev
- php7.4-fpm
- php7.4-gd
- php7.4-gmp
- php7.4-imap
- php7.4-intl
- php7.4-json
- php7.4-ldap
- php7.4-mbstring
- php7.4-mysql
- php7.4-opcache
- php7.4-pgsql
- php7.4-readline
- php7.4-soap
- php7.4-sqlite3
- php7.4-tidy
- php7.4-xml
- php7.4-xmlrpc
- php7.4-zip
- postgresql
- python3-psycopg2
- name: Configure PostgreSQL database
postgresql_db: name={{ owncloud_dbname }}
become: true
become_user: postgres
- name: Configure PostgreSQL user
postgresql_user: db={{ owncloud_dbname }} name={{ owncloud_dbuser }} password={{ owncloud_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/{{ nextcloud_domain }}.key -out /etc/nginx/ssl/{{ nextcloud_domain }}.crt -days 730 -subj "/CN={{ nextcloud_domain }}" creates=/etc/nginx/ssl/{{ nextcloud_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager for nextcloud
template: src=certs.j2 dest=/etc/acertmgr/{{ nextcloud_domain }}.conf
notify: Run acertmgr
- name: Create vhost directory
file: path=/var/www/nextcloud state=directory owner=www-data group=www-data
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/nextcloud
notify: Restart nginx
# FIXME currently PHP handled out of ansible
#- name: Configure php7.4-fpm
# copy: src=www.conf dest=/etc/php/7.4/fpm/pool.d/www.conf
# notify: Restart php7.4-fpm
# FIXME currently PHP handled out of ansible
#- name: Configure php7.4 opcache
# copy: src=opcache.ini dest=/etc/php/7.4/mods-available/opcache.ini
# notify: Restart php7.4-fpm
- name: Enable vhost
file: src=/etc/nginx/sites-available/nextcloud dest=/etc/nginx/sites-enabled/nextcloud state=link
notify: Restart nginx
- name: Start php7.4-fpm
service: name=php7.4-fpm state=started enabled=yes
- name: Start PostgreSQL
service: name=postgresql state=started enabled=yes