---

- name: Install MariaDB repo for CentOS 7
  copy: src=../files/centos7.repo dest=/etc/yum.repos.d/mariadb.repo
  tags:
    - mariadb

- name: Install MariaDB server and client
  action: yum name={{ item }}
  with_items:
    - MariaDB-server
    - MariaDB-client
  tags:
    - mariadb

- name: Start the MariaDB service
  action: service name=mariadb state=started
  tags:
    - mariadb

---

- name: Install MariaDB repo for CentOS 7
  copy: src=../files/centos7.repo dest=/etc/yum.repos.d/mariadb.repo
  tags:
    - mariadb

- name: Install MariaDB server and client
  action: yum name={{ item }}
  with_items:
    - MariaDB-server
    - MariaDB-client
  tags:
    - mariadb

# 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user
- name: update mysql root password for all root accounts
  mysql_user: name=root host={{ item }} password={{ mysql_root_password }}
  with_items:
    - {{ ansible_hostname }}
    - 127.0.0.1
    - ::1
    - localhost

- name: delete anonymous MySQL server user for $server_hostname
  action: mysql_user user="" host="{{ server_hostname }}" state="absent"

- name: delete anonymous MySQL server user for localhost
  action: mysql_user user="" state="absent"

- name: remove the MySQL test database
  action: mysql_db db=test state=absent

- name: Start the MariaDB service
  action: service name=mariadb state=started
  tags:
    - mariadb

Remove the default DB and users from mysql
Remove the default DB and users from mysql
