1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Install MySQL/MariaDB on-demand--for MediaWiki, WordPress, Matomo &/or Admin Console

This commit is contained in:
root 2023-11-05 12:14:46 -05:00
parent 8def5c98cf
commit 402ce97d1d
11 changed files with 133 additions and 48 deletions

View file

@ -0,0 +1,15 @@
- name: Enable & Start MySQL ({{ mysql_service }}) systemd service, if mysql_enabled
systemd:
name: "{{ mysql_service }}"
daemon_reload: yes
state: started
enabled: yes
when: mysql_enabled
# We had to start MySQL in order to configure it, now turn if off if not enabled
- name: Disable & Stop MySQL ({{ mysql_service }}) systemd service, if not mysql_enabled
systemd:
name: "{{ mysql_service }}"
enabled: no
state: stopped
when: not mysql_enabled

View file

@ -26,40 +26,33 @@
var: mysql_installed
- name: Install MySQL if 'mysql_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: install.yml
when: mysql_installed is undefined
- block:
- name: Install MySQL if 'mysql_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: install.yml
when: mysql_installed is undefined
- name: Enable & Start MySQL ({{ mysql_service }}) systemd service, if mysql_enabled
systemd:
name: "{{ mysql_service }}"
daemon_reload: yes
state: started
enabled: yes
when: mysql_enabled
- include_tasks: enable-or-disable.yml
# We had to start MySQL in order to configure it, now turn if off if not enabled
- name: Disable & Stop MySQL ({{ mysql_service }}) systemd service, if not mysql_enabled
systemd:
name: "{{ mysql_service }}"
enabled: no
state: stopped
when: not mysql_enabled
- name: Add 'mysql' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: mysql
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: name
value: MySQL
- option: description
value: '"MySQL is a widely used free and open source (GPLv2) database, offered by most web hosting services, on a diversity of platforms."'
- option: mysql_install
value: "{{ mysql_install }}"
- option: mysql_enabled
value: "{{ mysql_enabled }}"
rescue:
- name: Add 'mysql' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: mysql
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: name
value: MySQL
- option: description
value: '"MySQL is a widely used free and open source (GPLv2) database, offered by most web hosting services, on a diversity of platforms."'
- option: mysql_install
value: "{{ mysql_install }}"
- option: mysql_enabled
value: "{{ mysql_enabled }}"
- name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})'
fail:
msg: ""
when: not skip_role_on_error