1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Update main.yml

This commit is contained in:
A Holt 2018-10-31 03:42:08 -04:00 committed by GitHub
parent 8b4a38a28a
commit d73097041f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
- name: Install MySQL (debuntu)
- name: Install MySQL packages: mariadb-server, mariadb-client, python-mysqldb and 8 php packages (debuntu)
package:
name:
- mariadb-server
@ -18,19 +18,19 @@
tags:
- download
- name: php-xml (ubuntu or debian-9)
- name: Install php{{ php_version }}-xml (ubuntu or debian-9)
package:
name: "php{{ php_version }}-xml"
state: present
when: is_ubuntu or is_debian_9
- name: php-xml (debian-8)
- name: Install php-xml-parser (debian-8)
package:
name: "php-xml-parser"
name: php-xml-parser
state: present
when: is_debian_8
- name: Install MySQL (OS's other than debuntu)
- name: "Install packages: mysql, MySQL-python and 9 php packages (OS's other than debuntu)"
package:
name:
- MySQL-python
@ -59,14 +59,15 @@
tags:
- download
# Name of mysql service varies by OS so softcoded in 1-prep
- name: Start the MySQL service
service:
# Name of MySQL service varies by OS so softcoded in 1-prep
- name: Start MySQL systemd service: {{ mysql_service }}
systemd:
name: "{{ mysql_service }}"
state: started
when: mysql_enabled
- name: Enable the MySQL service
service:
- name: Enable MySQL systemd service (upon subsequent boots) if mysql_enabled
systemd:
name: "{{ mysql_service }}"
enabled: yes
when: mysql_enabled
@ -74,17 +75,15 @@
# 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user
# unfortunately it still doesn't work
- name: Update MySQL root password for localhost root accounts
- name: Update MySQL root password for localhost root accounts, if mysql_enabled
mysql_user:
name: root
host: "{{ item }}"
host: localhost
password: "{{ mysql_root_password }}"
priv: "*.*:ALL,GRANT"
with_items:
- localhost
when: mysql_enabled
- name: Install .my.cnf file from template, with root password credentials
- name: Install .my.cnf file from template, with root password credentials, if mysql_enabled
template:
src: my.cnf.j2
dest: /root/.my.cnf
@ -92,7 +91,7 @@
mode: 0600
when: mysql_enabled
- name: Update MySQL root password for all remaining root accounts
- name: Update MySQL root password for all remaining root accounts (127.0.0.1, ::1) if mysql_enabled
mysql_user:
name: root
host: "{{ item }}"
@ -104,36 +103,36 @@
- ::1
when: mysql_enabled
- name: Delete anonymous MySQL server user for {{ ansible_hostname }}
- name: Delete anonymous MySQL server user for {{ ansible_hostname }}, if mysql_enabled
mysql_user:
user: ""
host: "{{ ansible_hostname }}"
state: absent
when: mysql_enabled
- name: Delete anonymous MySQL server user for localhost
- name: Delete anonymous MySQL server user for localhost, if mysql_enabled
mysql_user:
user: ""
state: absent
when: mysql_enabled
- name: Remove the MySQL test database
- name: Remove the MySQL 'test' database, if mysql_enabled
mysql_db:
db: test
state: absent
when: mysql_enabled
# we had to start mysql in order to configure it, now turn if off if not enabled
- name: Provisionally Disable the MySQL service
service:
- name: Config is done but now DISABLE MySQL service, if not mysql_enabled
systemd:
name: "{{ mysql_service }}"
enabled: no
state: stopped
when: not mysql_enabled
- name: Add 'mysql' to list of services at {{ iiab_ini_file }}
- name: Add 'mysql' variable values to {{ iiab_ini_file }}
ini_file:
dest: "{{ iiab_ini_file }}"
path: "{{ iiab_ini_file }}"
section: mysql
option: "{{ item.option }}"
value: "{{ item.value }}"