2017-05-27 18:09:50 +00:00
- name : Install MySQL Debian
package : name={{ item }}
state=present
with_items :
- mariadb-server
- mariadb-client
- python-mysqldb
2017-05-27 23:10:45 +00:00
- php{{ php_version }}
- php{{ php_version }}-mysql
2017-05-27 18:09:50 +00:00
- php-pear
2017-05-27 23:10:45 +00:00
- php{{ php_version }}-gd
- php{{ php_version }}-imap
- php{{ php_version }}-ldap
- php{{ php_version }}-odbc
2017-07-18 02:46:30 +00:00
# - php{{ php_version }}-xml
2017-05-27 23:10:45 +00:00
- php{{ php_version }}-xmlrpc
when : is_debuntu
2017-05-27 18:09:50 +00:00
tags :
- download
2017-07-18 02:46:30 +00:00
- name : php-xml for ubuntu and debian-9
package : name=php{{ php_version }}-xml state=present
when : is_ubuntu or is_debian_9
- name : php-xml for debian-8
package : name=php-xml-parser state=present
when : is_debian_8
2017-05-27 18:09:50 +00:00
- name : Install MySQL
package : name={{ item }}
state=present
with_items :
- MySQL-python
- mysql
- php
- php-mysql
- php-pear
- php-gd
- php-imap
- php-ldap
- php-odbc
- php-xml
- php-xmlrpc
2017-05-27 23:10:45 +00:00
when : not is_debuntu
2017-05-27 18:09:50 +00:00
tags :
- download
- include : centos.yml
when : ansible_distribution == "CentOS"
tags :
- download
- include : fedora.yml
when : ansible_distribution == "Fedora"
tags :
- download
# Name of mysql service varies by OS so softcoded in 1-prep
- name : Start the MySQL service
service : name={{ mysql_service }}
state=started
- name : Enable the MySQL service
service : name={{ mysql_service }}
enabled=yes
when : mysql_enabled
# '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
mysql_user : name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT
with_items :
- localhost
when : mysql_enabled
- name : copy .my.cnf file with root password credentials
template : src=my.cnf.j2 dest=/root/.my.cnf owner=root mode=0600
when : mysql_enabled
- name : update mysql root password for all remaining root accounts
mysql_user : name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT
with_items :
2017-06-09 23:25:56 +00:00
# - "{{ iiab_hostname }}.{{ iiab_domain }}"
2017-05-27 18:09:50 +00:00
- 127.0 .0 .1
- : : 1
when : mysql_enabled
- name : delete anonymous MySQL server user for {{ ansible_hostname }}
mysql_user : user="" host="{{ ansible_hostname }}" state="absent"
when : mysql_enabled
- name : delete anonymous MySQL server user for localhost
mysql_user : user="" state="absent"
when : mysql_enabled
- name : remove the MySQL test database
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
2017-10-01 22:48:50 +00:00
- name : Provisionally Disable the MySQL service
2017-05-27 18:09:50 +00:00
service : name={{ mysql_service }}
enabled=no
state=stopped
when : not mysql_enabled
- name : add mysql to service list
ini_file : dest='{{ service_filelist }}'
section=mysql
option='{{ item.option }}'
value='{{ item.value }}'
with_items :
- option : name
value : mysql-database
- option : description
value : '"mySQL is a widely used database service on the Internet which runs on many platforms, and is often offered and available at hosting Internet Service Providers"'
- option : enabled
value : "{{ mysql_enabled }}"