Skip to content

Commit 460eedf

Browse files
author
Colin Hoglund
committed
adding ability to use official mysql repo
1 parent f0f322d commit 460eedf

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

defaults/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ overwrite_global_mycnf: yes
1515
# mysql_config_file: /etc/my.cnf
1616
# mysql_config_include_dir: /etc/my.cnf.d
1717

18+
# Use repo.mysql.com to install mysql packages. Used only for Debian based systems
19+
mysql_apt_repo_enable: false
20+
# override this if you want to install older versions of mysql on newer OS releases
21+
mysql_apt_repo_release: "{{ansible_distribution_release}}"
22+
# check the repo for available entries
23+
# Example: http://repo.mysql.com/apt/ubuntu/dists/trusty/
24+
mysql_apt_repo_entries: [mysql-5.7]
25+
1826
# Pass in a comma-separated list of repos to use (e.g. "remi,epel"). Used only
1927
# for RedHat systems (and derivatives).
2028
mysql_enablerepo: ""

tasks/setup-Debian.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
stat: path=/etc/init.d/mysql
44
register: mysql_installed
55

6+
- name: Add repo.mysql.com apt key
7+
apt_key: url=http://repo.mysql.com/RPM-GPG-KEY-mysql
8+
when: mysql_apt_repo_enable
9+
10+
- name: Add repo.mysql.com apt repo
11+
apt_repository:
12+
repo: "deb http://repo.mysql.com/apt/{{ansible_distribution|lower}}/ {{mysql_apt_repo_release}} {{item}}"
13+
with_items: "{{mysql_apt_repo_entries}}"
14+
when: mysql_apt_repo_enable
15+
16+
- name: Update apt to prefer repo.mysql.com packages
17+
copy:
18+
content: |
19+
Package: *
20+
Pin: origin repo.mysql.com
21+
Pin-Priority: 900
22+
dest: /etc/apt/preferences.d/mysql
23+
owner: root
24+
group: root
25+
mode: 0644
26+
when: mysql_apt_repo_enable
27+
628
- name: Update apt cache if MySQL is not yet installed.
729
apt: update_cache=yes
830
when: mysql_installed.stat.exists == false

0 commit comments

Comments
 (0)