From cbb84598b9ce8a758e1c23760cac2fc19065224a Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 5 Feb 2020 23:56:41 -0600 Subject: [PATCH] Set up a database for nextcloud --- ec2.yml | 7 +++++++ roles/nextcloud/tasks/main.yml | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/ec2.yml b/ec2.yml index c44932b..59e80bf 100755 --- a/ec2.yml +++ b/ec2.yml @@ -16,6 +16,13 @@ 39636637643035616236663364663562366133613233313139623937313531343564 acme_directory: "https://acme-staging-v02.api.letsencrypt.org/directory" acme_version: 2 + nextcloud_mysql_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 37633035633563646266346264333636393931323664313166633133653461646333643731636661 + 3966666665396239346662613764353333393038663762340a313236396331623061376462356437 + 66373234633939393034353439393465663131303661393164303335336435653734613064663964 + 3332313764623133630a393731613236373837316437653265636663666261383135636662373566 + 61373135303632336237333836353764646639633735323566346366623766646266 nextcloud_tarbz2: "https://download.nextcloud.com/server/releases/nextcloud-18.0.0.tar.bz2" nextcloud_url: "nc.assburgers.club" nextcloud_webroot: "/var/www/nextcloud" diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index f50d4e9..e026cad 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -34,6 +34,22 @@ 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 MySQL + block: + - name: Create database + mysql_db: + name: nextclouddb + login_user: root + login_password: "{{ mysql_root_password }}" + state: present + - name: Create Nextcloud user + mysql_user: + name: nextcloud + host: localhost + password: "{{ nextcloud_mysql_password }}" + priv: "nextclouddb.*:ALL,GRANT" + login_user: root + login_password: "{{ mysql_root_password }}" - name: Set up Apache block: - name: Disable default configuration