You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.8 KiB
YAML

---
- name: Install dependencies for mysql database
apt:
state: present
name:
- mariadb-server
- mariadb-client
notify: restart mysql
- name: Install ansible dependencies for configuring
pip:
state: present
name:
- PyMySQL
- meta: flush_handlers
- name: Lock root user for localhost
mysql_user:
user: "root"
password: "{{ mysql_root_password }}"
host: "localhost"
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Remove test user for public
mysql_user:
user: ""
host: "{{ ansible_fqdn }}"
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Remove test user in general
mysql_user:
user: ""
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Lock root user for ::1
mysql_user:
user: "root"
password: "{{ mysql_root_password }}"
host: "::1"
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Lock root user for 127.0.0.1
mysql_user:
user: "root"
password: "{{ mysql_root_password }}"
host: "127.0.0.1"
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Lock root user for localhost
mysql_user:
user: "root"
password: "{{ mysql_root_password }}"
host: "localhost"
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Disable public root user access
mysql_user:
user: "root"
host: "{{ ansible_fqdn }}"
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Remove mysql test database
mysql_db:
db: "test"
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Configure innodb of mysql
copy:
dest: "/etc/mysql/conf.d/innodb.cnf"
content: |
[mysqld]
innodb_large_prefix=ON
innodb_file_format=barracuda
innodb_file_per_table=ON
notify:
- restart mysql