You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

50 lines
1.3 KiB

---
- name: MySQL already installed ?
shell: dpkg -l|egrep "mysql|mariadb"|grep -iq serv
ignore_errors: true
register: mysql
- name: update apt-cache
apt: update_cache=yes
- name: Install prerequisites packages
apt: pkg={{item}} state=installed install_recommends=no update_cache=yes
with_items:
- python-software-properties
- php5-cli
- php5-mysql
when: mysql|failed
- name: Add MariaDB repository Key
apt_key: keyserver=keyserver.ubuntu.com id=0xcbcb082a1bb943db state=present
when: mysql|failed
- name: Add Mariadb repository file
template: src=etc-apt-sources.list.d-mariadb.list dest=/etc/apt/sources.list.d/mariadb.list
when: mysql|failed
- name: Install Mariadb packages
apt: pkg={{item}} state=installed update_cache=yes
with_items:
- mariadb-server-{{ mariadb_version | default("10") }}
- python-mysqldb
- percona-toolkit
when: mysql|failed
- name: Set root mysql password
mysql_user: name=root password={{ mysql_root_password | default("changeme") }}
when: mysql|failed
- name: File .my.cnf for root
template: src={{item.src}} dest={{item.dest}}
with_items :
- { src: root-.my.cnf , dest: /root/.my.cnf }
when: mysql|failed
- name: Ensure 600 permissions on my.cnf
file: path=/root/.my.cnf mode=600
when: mysql|failed
# vim: set textwidth=0 ft=yaml ts=2 sw=2 expandtab:
#