ansible-personal/roles/mariadb/tasks/main.yml

37 lines
1.1 KiB
YAML

---
- name: Add GPG key for MariaDB repo
apt_key: id=0xcbcb082a1bb943db url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db
tags: mariadb
- name: Add MariaDB 10.0 repo
apt_repository: repo="deb http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu {{ ansible_distribution_release }} main" state=present
tags: mariadb
- name: Install mariadb-server
apt: name={{ item }} state=present update_cache=yes
with_items:
- mariadb-server
# - python-mysqldb # for ansible
tags: mariadb
- 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
# vim: set ts=2 sw=2: