2014-08-16 23:35:57 +02:00
|
|
|
---
|
|
|
|
- name: Add GPG key for MariaDB repo
|
|
|
|
apt_key: id=0xcbcb082a1bb943db url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db
|
|
|
|
tags: mariadb
|
|
|
|
|
2015-10-19 22:54:26 +02:00
|
|
|
- name: Add MariaDB 10.1 repo
|
|
|
|
apt_repository: repo="deb http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.1/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} main" state=present
|
2014-08-16 23:35:57 +02:00
|
|
|
tags: mariadb
|
|
|
|
|
|
|
|
- name: Install mariadb-server
|
|
|
|
apt: name={{ item }} state=present update_cache=yes
|
|
|
|
with_items:
|
|
|
|
- mariadb-server
|
2014-08-27 14:56:54 +02:00
|
|
|
- python-mysqldb # for ansible
|
2014-08-16 23:35:57 +02:00
|
|
|
tags: mariadb
|
|
|
|
|
2016-04-22 09:08:32 +02:00
|
|
|
- name: Create system my.cnf
|
|
|
|
template: src=my.cnf.j2 dest=/etc/mysql/my.cnf owner=root group=root mode=0644
|
|
|
|
notify:
|
|
|
|
- restart mysql
|
|
|
|
tags: mariadb
|
|
|
|
|
2014-08-16 23:35:57 +02:00
|
|
|
- name: Start and enable MariaDB Service
|
|
|
|
service: name=mysql state=started enabled=true
|
|
|
|
tags: mariadb
|
|
|
|
|
|
|
|
# 'localhost' needs to be the last item for idempotency, see
|
|
|
|
# http://ansible.cc/docs/modules.html#mysql-user
|
|
|
|
- name: Update MariaDB root password for all root accounts
|
|
|
|
mysql_user: name=root host={{ item }} password={{ mariadb_root_password }}
|
|
|
|
with_items:
|
|
|
|
- "{{ inventory_hostname }}"
|
|
|
|
- 127.0.0.1
|
|
|
|
- ::1
|
|
|
|
- localhost
|
|
|
|
tags: mariadb
|
|
|
|
|
|
|
|
- name: Create .my.conf file with root credentials
|
|
|
|
template: src=.my.cnf.j2 dest=/root/.my.cnf owner=root mode=0600
|
|
|
|
tags: mariadb
|
|
|
|
|
2014-08-28 11:47:30 +02:00
|
|
|
- name: Create WordPress database(s)
|
2015-12-08 16:27:37 +01:00
|
|
|
mysql_db: db={{ item.wordpress_db_name }} state=present encoding=utf8mb4
|
2016-03-11 17:53:07 +01:00
|
|
|
with_items: "{{ wordpress_blogs }}"
|
2014-08-28 13:29:23 +02:00
|
|
|
when: wordpress_blogs is defined
|
2014-08-28 11:47:30 +02:00
|
|
|
tags: mariadb
|
|
|
|
|
|
|
|
- name: Create WordPress user(s)
|
|
|
|
mysql_user: name={{ item.wordpress_db_user }} password={{ item.wordpress_db_pass }} priv={{ item.wordpress_db_name }}.*:ALL state=present
|
2016-03-11 17:53:07 +01:00
|
|
|
with_items: "{{ wordpress_blogs }}"
|
2014-08-28 13:29:23 +02:00
|
|
|
when: wordpress_blogs is defined
|
2014-08-28 11:47:30 +02:00
|
|
|
tags: mariadb
|
|
|
|
|
2014-08-16 23:35:57 +02:00
|
|
|
# vim: set ts=2 sw=2:
|