Skip to content

Instantly share code, notes, and snippets.

@bjallen
Created September 10, 2014 21:13
Show Gist options
  • Save bjallen/5e4f7a6a09869601000c to your computer and use it in GitHub Desktop.
Save bjallen/5e4f7a6a09869601000c to your computer and use it in GitHub Desktop.
ansible mysql percona task
---
- name: Add Percona apt signing key
sudo: yes
apt_key: keyserver=keys.gnupg.net id=1C4CBDCDCD2EFD2A state=present
- name: Add Percona repository
sudo: yes
apt_repository: repo='deb http://repo.percona.com/apt trusty main' state=present
- name: Add Percona source repository
sudo: yes
apt_repository: repo='deb-src http://repo.percona.com/apt trusty main' state=present
- name: Update apt cache
sudo: yes
apt: update_cache=yes
- name: Install python packages
sudo: yes
apt: pkg={{ item }} state=present
with_items:
- vim
- python-pycurl
- python-mysqldb
- name: Install Percona packages
sudo: yes
apt: pkg={{ item }} state=present update_cache=yes
with_items:
- percona-server-common-5.6
- percona-server-client-5.6
- percona-server-server-5.6
environment:
DEBIAN_FRONTEND: noninteractive
- name: Create Mysql configuration file
sudo: yes
template: src=server.my.cnf.j2 dest=/etc/mysql/my.cnf
notify:
- restart mysql
- name: Update mysql root password for all root accounts
sudo: yes
mysql_user: name=root host={{ item }} password={{ mysql_root_password }}
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
- name: Copy .my.cnf file with root password credentials
sudo: yes
template: src=root.my.cnf.j2 dest=~/.my.cnf mode=0600
@fnzv
Copy link

fnzv commented Aug 8, 2017

Hello,
Change to the new Percona ( https://www.percona.com/blog/2016/10/13/new-signing-key-for-percona-debian-and-ubuntu-packages/ ):

  • name: Add Percona apt signing key
    sudo: yes
    apt_key: keyserver=keys.gnupg.net id=8507EFA5 state=present

And will work

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