Commit 1731c0c3 by Kevin Falcone

Undo the work done to switch from ondrej to mysql's apt repo

We will use the community PPA for 12.04
Ondrej's PPA for 16.04

Even if the community PPA releases 5.6 packages, we're unlikely to
switch back on 16.04.  We'll just work towards 5.7 which are included
natively in 16.04.
parent 346c9ef2
---
remove_experimental_mysql: false
mysql_debian_pkgs:
- "mysql-server-5.6"
- python-mysqldb
---
- name: Look for mysql 5.6
shell: "dpkg -s mysql-server"
ignore_errors: yes
register: mysql_56_installed
changed_when: no
# TODO remove after we release a 16.04 Devstack
- name: Add MySQL community apt key
apt_key:
id: 8C718D3B5072E1F5
keyserver: "{{ COMMON_EDX_PPA_KEY_SERVER }}"
state: present
when: ansible_distribution_release == 'precise'
- name: Important message
debug:
msg: |
"MySQL experimental is already installed, make 'remove_experimental_mysql: true' in defaults/main.yml,
if you want to remove it and install the stable version of MySQL"
when: "'5.6.14' in mysql_56_installed.stdout and not remove_experimental_mysql"
# TODO remove after we release a 16.04 Devstack
# Despite ondrej's ppa having 12.04 support, we would need to do shenanigans and uninstalling
# to switch back cleanly without publishing a new base devstack box. Easier to just clean this
# up with Ficus.
- name: Install MySQL from their community PPA
apt_repository:
repo: "deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6"
update_cache: yes
when: ansible_distribution_release == 'precise'
- pause:
seconds: 10
when: "'5.6.14' in mysql_56_installed.stdout and not remove_experimental_mysql"
# repo.mysql.com does not have 5.6 packages for xenial
- name: Install MySQL from ondrej PPA
apt_repository:
repo: "ppa:ondrej/mysql-5.6"
update_cache: yes
when: ansible_distribution_release == 'xenial'
# remove this, once the new devstack is out
- include: remove_mysql_experimental.yml
when: remove_experimental_mysql
- name: Install mysql-5.6 and dependencies
apt:
name: "{{ item }}"
install_recommends: yes
state: present
with_items: mysql_debian_pkgs
- include: mysql.yml
when: (mysql_56_installed.rc == 1) or (remove_experimental_mysql)
\ No newline at end of file
- name: Start mysql
service:
name: mysql
state: started
- name: Ensure Anonymous user(s) does not exist
mysql_user:
name: ''
host: "{{ item }}"
state: absent
with_items:
- localhost
- "{{ ansible_hostname }}"
---
# Here are the few steps that I have performed to get the `debconf` setting information:
#
# - downloaded the mysql-apt-repo from the mysql official site(named: mysql-apt-config_0.6.0-1_all.deb)
# - Find the `debconf` setting information after installing this `deb` package
#
# # debconf-show mysql-apt-config
# * mysql-apt-config/select-server: mysql-5.6
# mysql-apt-config/unsupported-platform: abort
# mysql-apt-config/repo-codename: precise
# * mysql-apt-config/select-product: Apply
# mysql-apt-config/select-tools:
# mysql-apt-config/repo-distro: ubuntu
#
# - Even to get more information about the `debconf` options of the package:
#
# # debconf-get-selections|grep mysql-apt-config
# mysql-apt-config mysql-apt-config/select-server select mysql-5.6
# mysql-apt-config mysql-apt-config/unsupported-platform select abort
# mysql-apt-config mysql-apt-config/repo-codename select precise
# mysql-apt-config mysql-apt-config/select-product select Apply
# mysql-apt-config mysql-apt-config/select-tools select
# mysql-apt-config mysql-apt-config/repo-distro select ubuntu
#
# - After the installation, I have checked the `/etc/apt/sources.list.d` directory and found one file `mysql.list`
# with following contents:
#
# deb http://repo.mysql.com/apt/ubuntu/ precise mysql-apt-config
# deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6
# deb-src http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6
#
#
# Thought that instead of performing all those steps and get the repo, why not directly use this repo
# `deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6`, I just picked this line and directly used it and it worked for us.
- name: Add MySQL community apt key
apt_key:
id: 8C718D3B5072E1F5
keyserver: "{{ COMMON_EDX_PPA_KEY_SERVER }}"
state: present
when: ansible_distribution_release == 'precise'
# Despite ondrej's ppa having 12.04 support, we would need to do shenanigans and uninstalling
# to switch back cleanly without publishing a new base devstack box. Easier to just clean this
# up with Ficus.
- name: Install MySQL from their community PPA
apt_repository:
repo: "deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6"
update_cache: yes
when: ansible_distribution_release == 'precise'
# repo.mysql.com does not have 5.6 packages for xenial
- name: Install MySQL from ondrej PPA
apt_repository:
repo: "ppa:ondrej/mysql-5.6"
update_cache: yes
when: ansible_distribution_release == 'xenial'
- name: Install mysql-5.6 and dependencies
apt:
name: "{{ item }}"
install_recommends: yes
state: present
with_items: mysql_debian_pkgs
- name: Start mysql
service:
name: mysql
state: started
- name: Ensure Anonymous user(s) does not exist
mysql_user:
name: ''
host: "{{ item }}"
state: absent
with_items:
- localhost
- "{{ ansible_hostname }}"
---
- name: Stop mysql service
service:
name: mysql
state: stopped
- name: Remove experimental apt repository
apt_repository:
repo: 'deb http://ppa.launchpad.net/ondrej/mysql-experimental/ubuntu precise main'
state: absent
- name: Remove experimental version of mysql
apt:
name: "{{ item }}"
state: absent
purge: yes
with_items:
- mysql-server-5.6
- mysql-server
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment