Work a bit more on that Apache setup

This commit is contained in:
Salt 2020-02-05 21:54:30 -06:00
parent 96a9671052
commit f9d69fe220
3 changed files with 50 additions and 8 deletions

View File

@ -9,6 +9,7 @@
vars:
acme_directory: "https://acme-staging-v02.api.letsencrypt.org/directory"
acme_version: 2
nextcloud_targz: "https://download.nextcloud.com/server/releases/nextcloud-18.0.0.tar.gz"
website_url: "nc.assburgers.club"
website_root: "/var/www/nextcloud"
roles:

View File

@ -10,18 +10,20 @@
packages:
- apache2
- mariadb-server
- libapache2-mod-php
- libapache2-mod-php7.2
- php7.2
- php7.2-xml
- php7.2-curl
- php7.2-gd
- php7.2-json
- php7.2-mysql
- php7.2-curl
- php7.2-mbstring
- php7.2-intl
- php-imagick
- php7.2-xml
- php7.2-zip
- php7.2-cgi
- php7.2-cli
- php7.2-zip
- php7.2-mysql
- php7.2-mbstring
- python-openssl # Needed for keygen
- python3-openssl
- name: Copy configuration
copy:
src: "{{ item.src }}"
@ -30,6 +32,38 @@
loop:
- { src: "php-apache2.ini", dest: "/etc/php/7.2/apache2/php.ini", mode: "0644" }
- { src: "php-cgi.ini", dest: "/etc/php/7.2/cgi/php.ini", mode: "0644" }
- name: Set up Apache
block:
- name: Configure virtual host
template:
src: apache2-vhost.conf
dest: "/etc/apache2/sites-enabled/{{ website_url }}.conf"
- name: Create webroot
file:
path: "{{ website_root }}"
mode: "0644"
recurse: yes
state: directory
- name: Check for existing installation
stat:
path: "{{ website_root }}/index.html"
register: stat_webroot_index
- name: Install Nextcloud
block:
- name: Download Nextcloud
get_url:
dest: /var/www/nextcloud.tar.gz
url: "{{ nextcloud_targz }}"
- name: Extract Nextcloud
unarchive:
src: /var/www/nextcloud.tar.gz
dest: "{{ website_root }}"
extra_opts: [--strip-components=1]
- name: Cleanup
file:
path: /var/www/nextcloud.tar.gz
state: absent
when: not stat_webroot_index.stat.exists
- name: Register certificates
block:
- name: Set up our filesystem heirarchy
@ -61,8 +95,9 @@
email_address: "rehashedsalt@cock.li"
- name: Create well-known directory
file:
mode: "0644"
path: "{{ website_root }}/.well-known/acme-challenge"
mode: "0644"
recurse: yes
state: directory
- name: Create challenge for CSR
acme_certificate:

View File

@ -0,0 +1,6 @@
# Configuration for {{ website_url }}
# vim:ft=apache:
<VirtualHost *:80>
ServerName {{ website_url }}
DocumentRoot {{ website_root }}
</VirtualHost>