Replaced Postgres with MariaDB for Nextcloud role

This commit is contained in:
Kris Lamoureux 2020-01-20 22:27:13 -05:00
parent 2c3df61caf
commit 370c3c6300
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
3 changed files with 23 additions and 27 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2019 Free I.T. Athens
# Copyright (C) 2019-2020 Free I.T. Athens
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -12,34 +12,24 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# psycopg2 is required for database tasks
- name: Install PostgreSQL Support for Python
apt: name=python-psycopg2 state=present
- name: Install PostgreSQL
apt: name=postgresql state=present
- name: Install MySQL Support for Python
apt:
name: python-pymysql
state: present
- name: Create Database
postgresql_db:
mysql_db:
name: "{{ nc_db_name }}"
state: present
become_user: postgres
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create Database User
postgresql_user:
user: "{{ nc_db_user }}"
mysql_user:
name: "{{ nc_db_user }}"
password: "{{ nc_db_pass }}"
db: "{{ nc_db_name }}"
priv: "{{ nc_db_name }}.*:ALL,GRANT"
state: present
become_user: postgres
- name: Add Database User Permissions
postgresql_privs:
db: "{{ nc_db_name }}"
role: "{{ nc_db_user }}"
objs: ALL_IN_SCHEMA
privs: SELECT,INSERT,UPDATE,DELETE
become_user: postgres
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Install PHP Modules
apt:
@ -100,7 +90,7 @@
- name: Install Nextcloud
command: |
php occ maintenance:install --database pgsql \
php occ maintenance:install --database mysql \
--database-name {{ nc_db_name }} --database-host {{ nc_db_host }} \
--database-user {{ nc_db_user }} --database-pass {{ nc_db_pass }} \
--admin-user {{ nc_admin }} --admin-pass {{ nc_admin_pass }} \
@ -131,4 +121,3 @@
args:
creates: /etc/apache2/sites-enabled/{{ nc_domain }}.conf
notify: Reload Apache2

View File

@ -1,3 +1,8 @@
- name: Install PostgreSQL Support for Python
apt:
name: python-psycopg2
state: present
- name: Install PostgreSQL
apt:
name: postgresql

View File

@ -15,16 +15,18 @@
# PyMySQL or MySQL-python is required for database tasks
- name: Install MySQL Support for Python
apt: name=python-pymysql state=present
apt:
name: python-pymysql
state: present
- name: Create Database
mysql_db:
mysql_db:
name: "{{ wp_db_name }}"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create Database User
mysql_user:
mysql_user:
name: "{{ wp_db_user }}"
password: "{{ wp_db_pass }}"
priv: "{{ wp_db_name }}.*:ALL,GRANT"
@ -57,7 +59,7 @@
remote_src: yes
- name: Generate Keys and Salts
get_url:
get_url:
url: https://api.wordpress.org/secret-key/1.1/salt/
dest: "{{ wp_dir }}/salts.txt"