summaryrefslogtreecommitdiffstats
path: root/pad/tasks/mariadb.yml
blob: ec814307899a98f508427c47bac7e96808fa8e99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 }}"