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: vars:
acme_directory: "https://acme-staging-v02.api.letsencrypt.org/directory" acme_directory: "https://acme-staging-v02.api.letsencrypt.org/directory"
acme_version: 2 acme_version: 2
nextcloud_targz: "https://download.nextcloud.com/server/releases/nextcloud-18.0.0.tar.gz"
website_url: "nc.assburgers.club" website_url: "nc.assburgers.club"
website_root: "/var/www/nextcloud" website_root: "/var/www/nextcloud"
roles: roles:

View File

@ -10,18 +10,20 @@
packages: packages:
- apache2 - apache2
- mariadb-server - mariadb-server
- libapache2-mod-php - libapache2-mod-php7.2
- php7.2 - php7.2
- php7.2-xml
- php7.2-curl
- php7.2-gd - 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-cgi
- php7.2-cli - php7.2-cli
- php7.2-zip
- php7.2-mysql
- php7.2-mbstring
- python-openssl # Needed for keygen - python-openssl # Needed for keygen
- python3-openssl
- name: Copy configuration - name: Copy configuration
copy: copy:
src: "{{ item.src }}" src: "{{ item.src }}"
@ -30,6 +32,38 @@
loop: loop:
- { src: "php-apache2.ini", dest: "/etc/php/7.2/apache2/php.ini", mode: "0644" } - { 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" } - { 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 - name: Register certificates
block: block:
- name: Set up our filesystem heirarchy - name: Set up our filesystem heirarchy
@ -61,8 +95,9 @@
email_address: "rehashedsalt@cock.li" email_address: "rehashedsalt@cock.li"
- name: Create well-known directory - name: Create well-known directory
file: file:
mode: "0644"
path: "{{ website_root }}/.well-known/acme-challenge" path: "{{ website_root }}/.well-known/acme-challenge"
mode: "0644"
recurse: yes
state: directory state: directory
- name: Create challenge for CSR - name: Create challenge for CSR
acme_certificate: acme_certificate:

View File

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