Last active
November 10, 2015 08:23
-
-
Save jasonrogena/74dc1f57f6b7cd799542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
#- name: Copy the MariaDB root non-interactive password | |
# template: src=mariadb_non_interactive_password.sh.j2 dest=/tmp/mariadb_non_interactive_password.sh owner=root group=root mode=0700 | |
# | |
#- name: Execute the MariaDB root non-interactive password file | |
# shell: /tmp/mariadb_non_interactive_password.sh | |
# | |
#- name: Delete the MariaDB non-interactive password file | |
# file: path=/tmp/mariadb_non_interactive_password.sh state=absent | |
- name: Set Debconf root_password | |
debconf: name=mariadb-server question='mysql-server/root_password' value='{{ mariadb_root_password }}' vtype='password' | |
- name: Set Debconf root_password_again | |
debconf: name=mariadb-server question='mysql-server/root_password_again' value='{{ mariadb_root_password }}' vtype='password' | |
- name: Add GPG key for MariaDB repo | |
apt_key: id=0xcbcb082a1bb943db url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db | |
- 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 | |
- name: Install mariadb-server | |
apt: name={{ item }} state=present update_cache=yes | |
with_items: | |
- mariadb-server | |
- python-mysqldb # for ansible | |
environment: | |
- DEBIAN_FRONTEND: noninteractive | |
notify: | |
- enable mariadb service | |
- start mariadb service | |
- name: Create .my.conf file for root user | |
template: src=.my.cnf.j2 dest=/root/.my.cnf owner=root mode=0600 | |
- 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 | |
# vim: set ts=2 sw=2: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oooh, I didn't know about the debconf module. I can accept licenses that way maybe, like the Oracle Java license I use on Tomcat servers. 👍