ansible/roles/web_plk/tasks/main.yml

53 lines
1.5 KiB
YAML
Raw Normal View History

---
- name: Install dependencies
apt:
name:
- exif
- imagemagick
- imagemagick-common
- libsodium23
- mariadb-server
- php-common
- php-curl
- php-fpm
- php-imagick
- php-json
- php-mbstring
- php-mysql
- php-seclib
- php-xml
- php-zip
- name: Create vhost directory
file: path=/var/www/plk state=directory owner=www-data group=www-data
# FIXME mysql_db and mysql_user is currently not working
# already tried installing python3-pymsql
# so for now mysql is handled manually
#- name: Configure MySQL database
# mysql_db: name={{ plk_dbname }}
#- name: Configure MySQL user
# mysql_user: name={{ plk_dbuser }} password={{ plk_dbpass }} priv={{ plk_dbname }}.*:ALL state=present
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ plk_domain }}.key -out /etc/nginx/ssl/{{ plk_domain }}.crt -days 730 -subj "/CN={{ plk_domain }}" creates=/etc/nginx/ssl/{{ plk_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager
template: src=certs.j2 dest=/etc/acertmgr/{{ plk_domain }}.conf
notify: Run acertmgr
# TODO vhost is configured manually to figure out what is needed for wordpress
#- name: Configure vhosts
# template: src=vhost.j2 dest=/etc/nginx/sites-available/plk
# notify: Restart nginx
- name: Enable vhosts
file: src=/etc/nginx/sites-available/plk dest=/etc/nginx/sites-enabled/plk state=link
notify: Restart nginx
- name: Start php7.3-fpm
service: name=php7.3-fpm state=started enabled=yes