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 # 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 # 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 # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# psycopg2 is required for database tasks - name: Install MySQL Support for Python
- name: Install PostgreSQL Support for Python apt:
apt: name=python-psycopg2 state=present name: python-pymysql
state: present
- name: Install PostgreSQL
apt: name=postgresql state=present
- name: Create Database - name: Create Database
postgresql_db: mysql_db:
name: "{{ nc_db_name }}" name: "{{ nc_db_name }}"
state: present state: present
become_user: postgres login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create Database User - name: Create Database User
postgresql_user: mysql_user:
user: "{{ nc_db_user }}" name: "{{ nc_db_user }}"
password: "{{ nc_db_pass }}" password: "{{ nc_db_pass }}"
db: "{{ nc_db_name }}" priv: "{{ nc_db_name }}.*:ALL,GRANT"
state: present state: present
become_user: postgres login_unix_socket: /var/run/mysqld/mysqld.sock
- 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
- name: Install PHP Modules - name: Install PHP Modules
apt: apt:
@ -100,7 +90,7 @@
- name: Install Nextcloud - name: Install Nextcloud
command: | command: |
php occ maintenance:install --database pgsql \ php occ maintenance:install --database mysql \
--database-name {{ nc_db_name }} --database-host {{ nc_db_host }} \ --database-name {{ nc_db_name }} --database-host {{ nc_db_host }} \
--database-user {{ nc_db_user }} --database-pass {{ nc_db_pass }} \ --database-user {{ nc_db_user }} --database-pass {{ nc_db_pass }} \
--admin-user {{ nc_admin }} --admin-pass {{ nc_admin_pass }} \ --admin-user {{ nc_admin }} --admin-pass {{ nc_admin_pass }} \
@ -131,4 +121,3 @@
args: args:
creates: /etc/apache2/sites-enabled/{{ nc_domain }}.conf creates: /etc/apache2/sites-enabled/{{ nc_domain }}.conf
notify: Reload Apache2 notify: Reload Apache2

View File

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

View File

@ -15,7 +15,9 @@
# PyMySQL or MySQL-python is required for database tasks # PyMySQL or MySQL-python is required for database tasks
- name: Install MySQL Support for Python - name: Install MySQL Support for Python
apt: name=python-pymysql state=present apt:
name: python-pymysql
state: present
- name: Create Database - name: Create Database
mysql_db: mysql_db: