Skip to content

Instantly share code, notes, and snippets.

@jasonrogena
Created November 4, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonrogena/088bb3c65c1c6deb3d55 to your computer and use it in GitHub Desktop.
Save jasonrogena/088bb3c65c1c6deb3d55 to your computer and use it in GitHub Desktop.
---
- 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 MariaDN root non-interactive password file
shell: /tmp/mariadb_non_interactive_password.sh
- name: Delete the non-interactive password file
file: path=/tmp/mariadb_non_interactive_password.sh state=absent
- 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
register: add_mariadb_10_1_repo
- name: Install mariadb-server
apt: name={{ item }} state=present update_cache=yes
with_items:
- mariadb-server
- python-mysqldb # for ansible
notify:
- enable mariadb service
- start mariadb service
register: install_mariadb
- 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:
@alanorth
Copy link

alanorth commented Nov 4, 2015

Your .my.cnf.j2 is actually with a dot in the file system? Will you remember it's actually there if it's invisible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment