1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +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: package:
name: name:
- mariadb-server - mariadb-server
@ -18,19 +18,19 @@
tags: tags:
- download - download
- name: php-xml (ubuntu or debian-9) - name: Install php{{ php_version }}-xml (ubuntu or debian-9)
package: package:
name: "php{{ php_version }}-xml" name: "php{{ php_version }}-xml"
state: present state: present
when: is_ubuntu or is_debian_9 when: is_ubuntu or is_debian_9
- name: php-xml (debian-8) - name: Install php-xml-parser (debian-8)
package: package:
name: "php-xml-parser" name: php-xml-parser
state: present state: present
when: is_debian_8 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: package:
name: name:
- MySQL-python - MySQL-python
@ -59,14 +59,15 @@
tags: tags:
- download - download
# Name of mysql service varies by OS so softcoded in 1-prep # Name of MySQL service varies by OS so softcoded in 1-prep
- name: Start the MySQL service - name: Start MySQL systemd service: {{ mysql_service }}
service: systemd:
name: "{{ mysql_service }}" name: "{{ mysql_service }}"
state: started state: started
when: mysql_enabled
- name: Enable the MySQL service - name: Enable MySQL systemd service (upon subsequent boots) if mysql_enabled
service: systemd:
name: "{{ mysql_service }}" name: "{{ mysql_service }}"
enabled: yes enabled: yes
when: mysql_enabled when: mysql_enabled
@ -74,17 +75,15 @@
# 'localhost' needs to be the last item for idempotency, see # 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user # http://ansible.cc/docs/modules.html#mysql-user
# unfortunately it still doesn't work # 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: mysql_user:
name: root name: root
host: "{{ item }}" host: localhost
password: "{{ mysql_root_password }}" password: "{{ mysql_root_password }}"
priv: "*.*:ALL,GRANT" priv: "*.*:ALL,GRANT"
with_items:
- localhost
when: mysql_enabled 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: template:
src: my.cnf.j2 src: my.cnf.j2
dest: /root/.my.cnf dest: /root/.my.cnf
@ -92,7 +91,7 @@
mode: 0600 mode: 0600
when: mysql_enabled 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: mysql_user:
name: root name: root
host: "{{ item }}" host: "{{ item }}"
@ -104,36 +103,36 @@
- ::1 - ::1
when: mysql_enabled 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: mysql_user:
user: "" user: ""
host: "{{ ansible_hostname }}" host: "{{ ansible_hostname }}"
state: absent state: absent
when: mysql_enabled when: mysql_enabled
- name: Delete anonymous MySQL server user for localhost - name: Delete anonymous MySQL server user for localhost, if mysql_enabled
mysql_user: mysql_user:
user: "" user: ""
state: absent state: absent
when: mysql_enabled when: mysql_enabled
- name: Remove the MySQL test database - name: Remove the MySQL 'test' database, if mysql_enabled
mysql_db: mysql_db:
db: test db: test
state: absent state: absent
when: mysql_enabled when: mysql_enabled
# we had to start mysql in order to configure it, now turn if off if not enabled # we had to start mysql in order to configure it, now turn if off if not enabled
- name: Provisionally Disable the MySQL service - name: Config is done but now DISABLE MySQL service, if not mysql_enabled
service: systemd:
name: "{{ mysql_service }}" name: "{{ mysql_service }}"
enabled: no enabled: no
state: stopped state: stopped
when: not mysql_enabled 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: ini_file:
dest: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"
section: mysql section: mysql
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value }}" value: "{{ item.value }}"