summaryrefslogtreecommitdiffstats
path: root/roles/pad/tasks/mariadb.yml
diff options
context:
space:
mode:
authorOpal <847966@proton.me>2022-10-15 15:27:41 -0700
committerOpal <847966@proton.me>2022-10-15 15:27:41 -0700
commita287e741842f67d0a04c48276221d85f16079d55 (patch)
tree2db596b4ba6709fe10168942bcd0fc5ed2850d02 /roles/pad/tasks/mariadb.yml
parentd86946ec21f2175d3a5aad58c1ae236291c74b7a (diff)
downloademacsconf-ansible-a287e741842f67d0a04c48276221d85f16079d55.tar.xz
emacsconf-ansible-a287e741842f67d0a04c48276221d85f16079d55.zip
merging code between old emacsconf repo, to sachac's emacsconf repo
Diffstat (limited to 'roles/pad/tasks/mariadb.yml')
-rw-r--r--roles/pad/tasks/mariadb.yml42
1 files changed, 42 insertions, 0 deletions
diff --git a/roles/pad/tasks/mariadb.yml b/roles/pad/tasks/mariadb.yml
new file mode 100644
index 0000000..ec81430
--- /dev/null
+++ b/roles/pad/tasks/mariadb.yml
@@ -0,0 +1,42 @@
+---
+- name: Install MySQL packages
+ apt:
+ name:
+ - mariadb-server
+ - mariadb-client
+ - python3-mysqldb
+- name: Ensure mysql is configured to bind only to localhost
+ ini_file:
+ dest: /etc/mysql/my.cnf
+ section: mysqld
+ option: "bind-address"
+ value: "127.0.0.1"
+- name: Start MariaDB
+ service:
+ name: mysql
+ state: restarted
+ enabled: yes
+ runlevel:
+ - 3
+ - 5
+- name: Ensure anonymous users are not in the database
+ mysql_user:
+ name: ""
+ host: "{{ item }}"
+ state: absent
+ with_items:
+ - localhost
+ - 127.0.0.1
+ - ::1
+ - "%"
+- name: Ensure emacsconf-pad database exists
+ mysql_db:
+ name: "{{ etherpad_database_name }}"
+ collation: utf8mb4_general_ci
+ state: present
+- name: Grant permissions to user
+ mysql_user:
+ name: "{{ etherpad_database_user }}"
+ state: present
+ priv: "{{ etherpad_database_name }}.*:ALL"
+ password: "{{ etherpad_database_password }}"