From 920e09be2c7dc571bf0720c7696bc107458adb85 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 23 Jan 2020 21:31:09 -0500 Subject: [PATCH] Update mysql/tasks/main.yml --- roles/mysql/tasks/main.yml | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index 48656e89f..706b1a4c3 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -1,3 +1,10 @@ +# TO DO: +# - Validate input vars mysql_install & mysql_enabled +# - Put ~12 stanzas just below into install.yml +# - Triggered by... 'when: mysql_installed is undefined' +# - Eliminate stale Fedora/CentOS code & gratuitous when: is_debuntu clauses? +# - Consider putting ~8 stanzas below that into enable.yml or similar? + - name: 'Install MySQL packages: mariadb-server, mariadb-client, and 8 php packages (debuntu)' package: name: @@ -14,19 +21,19 @@ - php{{ php_version }}-xmlrpc state: present when: is_debuntu | bool - #tags: download -- name: Install php{{ php_version }}-xml (ubuntu or debian 9+) +- name: Install package 'php{{ php_version }}-xml' (debuntu) # WAS: (ubuntu or debian 9+) package: name: "php{{ php_version }}-xml" state: present - when: is_ubuntu or (is_debian and not is_debian_8) + when: is_debuntu | bool + #when: is_ubuntu or (is_debian and not is_debian_8) -- name: Install php-xml-parser (debian-8) - package: - name: php-xml-parser - state: present - when: is_debian_8 | bool +#- name: Install php-xml-parser (debian-8) +# package: +# name: php-xml-parser +# state: present +# when: is_debian_8 | bool - name: "Install packages: mysql, MySQL-python and 9 php packages (OS's other than debuntu)" package: @@ -44,15 +51,12 @@ - php-xmlrpc state: present when: not is_debuntu - #tags: download - include_tasks: centos.yml when: ansible_distribution == "CentOS" - #tags: download - include_tasks: fedora.yml when: ansible_distribution == "Fedora" - #tags: download # 2019-07-03 @jvonau @holta: the next 50 lines (6 stanzas) double MariaDB's @@ -110,6 +114,12 @@ # line: "TimeoutStartSec=180" when: mariadb_unit_file.stat.exists +- name: "Add 'mysql_installed: True' to {{ iiab_state_file }}" + lineinfile: + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + regexp: '^mysql_installed' + line: 'mysql_installed: True' + # Name of MySQL service varies by OS, so hardcoded in /opt/iiab/iiab/vars/.yml (formerly in roles/0-init/tasks/main.yml) - name: Enable & Start MySQL systemd service ({{ mysql_service }}) if mysql_enabled @@ -178,6 +188,7 @@ state: stopped when: not mysql_enabled + - name: Add 'mysql' variable values to {{ iiab_ini_file }} ini_file: path: "{{ iiab_ini_file }}"