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-28 12:03:35 -04:00 committed by GitHub
parent 379102824c
commit e101d2f42c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,148 +1,146 @@
- name: Install MySQL (debuntu) - name: Install MySQL (debuntu)
package: package:
name: "{{ item }}" name:
state: present - mariadb-server
with_items: - mariadb-client
- mariadb-server - python-mysqldb
- mariadb-client - php{{ php_version }}
- python-mysqldb - php{{ php_version }}-mysql
- php{{ php_version }} - php-pear
- php{{ php_version }}-mysql - php{{ php_version }}-gd
- php-pear - php{{ php_version }}-imap
- php{{ php_version }}-gd - php{{ php_version }}-ldap
- php{{ php_version }}-imap - php{{ php_version }}-odbc
- php{{ php_version }}-ldap #- php{{ php_version }}-xml
- php{{ php_version }}-odbc - php{{ php_version }}-xmlrpc
# - php{{ php_version }}-xml state: present
- php{{ php_version }}-xmlrpc when: is_debuntu
when: is_debuntu tags:
tags: - download
- download
- name: php-xml (ubuntu or debian-9) - name: php-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: php-xml (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 MySQL (OS's other than debuntu)
package: package:
name: "{{ item }}" name:
state: present - MySQL-python
with_items: - mysql
- MySQL-python - php
- mysql - php-mysql
- php - php-pear
- php-mysql - php-gd
- php-pear - php-imap
- php-gd - php-ldap
- php-imap - php-odbc
- php-ldap - php-xml
- php-odbc - php-xmlrpc
- php-xml state: present
- php-xmlrpc when: not is_debuntu
when: not is_debuntu tags:
tags: - download
- download
- include_tasks: centos.yml - include_tasks: centos.yml
when: ansible_distribution == "CentOS" when: ansible_distribution == "CentOS"
tags: tags:
- download - download
- include_tasks: fedora.yml - include_tasks: fedora.yml
when: ansible_distribution == "Fedora" when: ansible_distribution == "Fedora"
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 the MySQL service
service: service:
name: "{{ mysql_service }}" name: "{{ mysql_service }}"
state: started state: started
- name: Enable the MySQL service - name: Enable the MySQL service
service: service:
name: "{{ mysql_service }}" name: "{{ mysql_service }}"
enabled: yes enabled: yes
when: mysql_enabled when: mysql_enabled
# '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
mysql_user: mysql_user:
name: root name: root
host: "{{ item }}" host: "{{ item }}"
password: "{{ mysql_root_password }}" password: "{{ mysql_root_password }}"
priv: "*.*:ALL,GRANT" priv: "*.*:ALL,GRANT"
with_items: with_items:
- localhost - localhost
when: mysql_enabled when: mysql_enabled
- name: Copy .my.cnf file with root password credentials - name: Install .my.cnf file from template, with root password credentials
template: template:
src: my.cnf.j2 src: my.cnf.j2
dest: /root/.my.cnf dest: /root/.my.cnf
owner: root owner: root
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
mysql_user: mysql_user:
name: root name: root
host: "{{ item }}" host: "{{ item }}"
password: "{{ mysql_root_password }}" password: "{{ mysql_root_password }}"
priv: "*.*:ALL,GRANT" priv: "*.*:ALL,GRANT"
with_items: with_items:
# - "{{ iiab_hostname }}.{{ iiab_domain }}" #- "{{ iiab_hostname }}.{{ iiab_domain }}"
- 127.0.0.1 - 127.0.0.1
- ::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 }}
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
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
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: Provisionally Disable the MySQL service
service: service:
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' to list of services at {{ iiab_ini_file }}
ini_file: ini_file:
dest: "{{ iiab_ini_file }}" dest: "{{ iiab_ini_file }}"
section: mysql section: mysql
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value }}" value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: MySQL value: MySQL
- option: description - 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."' value: '"MySQL is a widely used free and open source (GPLv2) database, offered by most web hosting services, on a diversity of platforms."'
- option: enabled - option: enabled
value: "{{ mysql_enabled }}" value: "{{ mysql_enabled }}"