2021-08-12 03:12:27 +00:00
- name: 'Install MySQL packages : mariadb-server, mariadb-client, php{{ php_version }}-mysql, python3-pymysql'
2020-02-04 20:03:59 +00:00
package :
name :
- mariadb-server
- mariadb-client
2021-06-27 22:25:49 +00:00
#- php{{ php_version }}-common # Auto-installed as an apt dependency. REGARDLESS: php{{ php_version }}-common superset php{{ php_version }}-cli is auto-installed by php{{ php_version }}-fpm in nginx/tasks/install.yml
2021-08-12 03:12:27 +00:00
- php{{ php_version }}-mysql # Likewise installed in nextcloud/tasks/install.yml, pbx/tasks/freepbx.yml, wordpress/tasks/install.yml
2021-07-29 16:40:50 +00:00
- python3-pymysql # For Ansible modules {mysql_db, mysql_user} in Ansible collection community.mysql -- used in MySQL roles {mediawiki, nextcloud, wordpress} and possibly {elgg, pbx}
2020-02-04 20:03:59 +00:00
state : present
2021-08-12 03:12:27 +00:00
# 2020-07-11: 10 PHP package installs moved to roles/www_base/tasks/main.yml
2020-07-11 16:50:20 +00:00
# php{{ php_version }}-sqlite3 install moved to roles/osm-vector-maps/tasks/install.yml
2020-07-11 16:47:04 +00:00
2021-08-12 03:12:27 +00:00
# 2021-08-11: 50 lines (6 stanzas) removed, that had been doubling MariaDB's
# default boot timeout (90s to 180s) since 2019-07-03, for slow CPUs like this
# Ubuntu 18.04.2 VM: https://github.com/iiab/iiab/issues/1802 -> PR #1813
# https://mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start/#systemd
# OS's have finally caught up - default timeout is now 900 seconds:
# https://github.com/iiab/iiab/pull/2936
2020-02-04 20:03:59 +00:00
# Name of MySQL service varies by OS, so hardcoded in /opt/iiab/iiab/vars/<OS>.yml (formerly in roles/0-init/tasks/main.yml)
2021-08-12 03:12:27 +00:00
- name : Restart MySQL systemd service ({{ mysql_service }}) to permit configuration
2020-02-04 20:03:59 +00:00
systemd :
daemon_reload : yes
2021-08-12 03:12:27 +00:00
name : "{{ mysql_service }}"
2020-02-04 20:03:59 +00:00
state : restarted
2021-08-02 18:34:55 +00:00
- name : "Install /root/.my.cnf file from template -- used to contain root password credential, prior to 2020-08-24: https://github.com/iiab/iiab/pull/2488"
2020-08-23 17:25:11 +00:00
template :
src : my.cnf.j2
dest : /root/.my.cnf
owner : root
mode : '0600'
2020-08-24 02:57:48 +00:00
#- name: Remove the MySQL 'test' database
# mysql_db:
# db: test
# state: absent
#- name: Delete anonymous MySQL server user for {{ ansible_hostname }}
# mysql_user:
# user: ""
# host: "{{ ansible_hostname }}"
# state: absent
#- name: Delete anonymous MySQL server user for localhost
# mysql_user:
# user: ""
# state: absent
2020-08-23 08:48:33 +00:00
2020-08-24 03:02:46 +00:00
#- name: Create MySQL root password for root accounts on (127.0.0.1, ::1)
# mysql_user:
# name: root
# host: "{{ item }}"
# password: "{{ mysql_root_password }}"
# priv: "*.*:ALL,GRANT"
# with_items:
# - 127.0.0.1
# - ::1
2020-02-04 20:03:59 +00:00
# RECORD MySQL AS INSTALLED
- name : "Set 'mysql_installed: True'"
set_fact :
mysql_installed : True
- name : "Add 'mysql_installed: True' to {{ iiab_state_file }}"
lineinfile :
path : "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp : '^mysql_installed'
line: 'mysql_installed : True '