Commit 0aa9bfa0 by Ned Batchelder Committed by GitHub

Merge pull request #3673 from edx/nedbat/mysql-from-edx-ppa

Install MySQL 5.6 from an edX repo
parents e4197b2c 6218350b
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
- "install:configuration" - "install:configuration"
# ubuntu # ubuntu
- stat: - stat:
path: "/usr/sbin/update-ca-certificates" path: "/usr/sbin/update-ca-certificates"
register: update_ca_certificates register: update_ca_certificates
...@@ -52,25 +52,22 @@ ...@@ -52,25 +52,22 @@
when: ansible_distribution in common_debian_variants when: ansible_distribution in common_debian_variants
# Ensure that we get the latest version of python 2.7 # Ensure that we can install old software if need be.
- name: add edx ppa apt key - name: Add edX PPA apt key
apt_key: apt_key:
id: "{{ COMMON_EDX_PPA_KEY_ID }}" id: "{{ COMMON_EDX_PPA_KEY_ID }}"
keyserver: "{{ COMMON_EDX_PPA_KEY_SERVER }}" keyserver: "{{ COMMON_EDX_PPA_KEY_SERVER }}"
state: "present" state: "present"
when: > when: >
ansible_distribution in common_debian_variants and ansible_distribution in common_debian_variants
ansible_distribution_release in common_custom_ppa_releases
- name: Add custom edX PPA - name: Add custom edX PPA
# Ensure that we get a current version of Git and latest version of python 2.7 # Ensure that we get the latest version of python 2.7
# GitHub requires version 1.7.10 or later # MySQL 5.6 is from our own PPA: https://bugs.mysql.com/bug.php?id=84848
# https://help.github.com/articles/https-cloning-errors
apt_repository: apt_repository:
repo: "{{ COMMON_EDX_PPA }}" repo: "{{ COMMON_EDX_PPA }}"
when: > when: >
ansible_distribution in common_debian_variants and ansible_distribution in common_debian_variants
ansible_distribution_release in common_custom_ppa_releases
- name: Install role-independent useful system packages - name: Install role-independent useful system packages
...@@ -78,7 +75,7 @@ ...@@ -78,7 +75,7 @@
apt: apt:
name: "{{ item }}" name: "{{ item }}"
install_recommends: yes install_recommends: yes
state: present state: present
update_cache: yes update_cache: yes
with_items: "{{ common_debian_pkgs }}" with_items: "{{ common_debian_pkgs }}"
when: ansible_distribution in common_debian_variants when: ansible_distribution in common_debian_variants
...@@ -89,15 +86,15 @@ ...@@ -89,15 +86,15 @@
install_recommends: yes install_recommends: yes
state: present state: present
update_cache: yes update_cache: yes
with_items: "{{ common_custom_debian_pkgs }}" with_items: "{{ old_python_debian_pkgs }}"
when: > when: >
ansible_distribution in common_debian_variants and ansible_distribution in common_debian_variants and
ansible_distribution_release in common_custom_ppa_releases ansible_distribution_release in old_python_ppa_releases
- name: Install role-independent useful system packages - name: Install role-independent useful system packages
yum: yum:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
update_cache: yes update_cache: yes
with_items: "{{ common_redhat_pkgs }}" with_items: "{{ common_redhat_pkgs }}"
when: ansible_distribution in common_redhat_variants when: ansible_distribution in common_redhat_variants
...@@ -106,24 +103,24 @@ ...@@ -106,24 +103,24 @@
- name: Create common directories - name: Create common directories
file: file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: "{{ item.state | default('directory') }}" state: "{{ item.state | default('directory') }}"
owner: "{{ item.owner | default('root') }}" owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}" group: "{{ item.group | default('root') }}"
mode: "0755" mode: "0755"
with_items: "{{ common_directories }}" with_items: "{{ common_directories }}"
- name: upload sudo config for key forwarding as root - name: upload sudo config for key forwarding as root
copy: copy:
src: ssh_key_forward src: ssh_key_forward
dest: /etc/sudoers.d/ssh_key_forward dest: /etc/sudoers.d/ssh_key_forward
validate: 'visudo -c -f %s' validate: 'visudo -c -f %s'
owner: root owner: root
group: root group: root
mode: "0440" mode: "0440"
- name: pip install virtualenv - name: pip install virtualenv
pip: pip:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}" extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}"
with_items: "{{ common_pip_pkgs }}" with_items: "{{ common_pip_pkgs }}"
...@@ -131,8 +128,8 @@ ...@@ -131,8 +128,8 @@
- name: update /etc/hosts - name: update /etc/hosts
template: template:
src: hosts.j2 src: hosts.j2
dest: /etc/hosts dest: /etc/hosts
when: COMMON_HOSTNAME|length > 0 when: COMMON_HOSTNAME|length > 0
register: etc_hosts register: etc_hosts
...@@ -152,8 +149,8 @@ ...@@ -152,8 +149,8 @@
template: template:
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
src: "{{ item.src }}" src: "{{ item.src }}"
owner: root owner: root
group: root group: root
mode: "{{ item.mode | default(0644) }}" mode: "{{ item.mode | default(0644) }}"
register: config_templates register: config_templates
with_items: with_items:
...@@ -165,8 +162,8 @@ ...@@ -165,8 +162,8 @@
# TODO: restarts no matter which template has changed, need to examine # TODO: restarts no matter which template has changed, need to examine
# the results # the results
- name: restart rsyslogd - name: restart rsyslogd
service: service:
name: rsyslog name: rsyslog
state: restarted state: restarted
become: True become: True
when: config_templates.changed when: config_templates.changed
......
...@@ -119,7 +119,7 @@ common_debian_pkgs: ...@@ -119,7 +119,7 @@ common_debian_pkgs:
- python2.7-dev - python2.7-dev
# Packages that should be installed from our custom PPA, i.e. COMMON_EDX_PPA # Packages that should be installed from our custom PPA, i.e. COMMON_EDX_PPA
common_custom_debian_pkgs: old_python_debian_pkgs:
- "python2.7=2.7.10-0+{{ ansible_distribution_release }}1" - "python2.7=2.7.10-0+{{ ansible_distribution_release }}1"
common_pip_pkgs: common_pip_pkgs:
...@@ -153,8 +153,8 @@ common_debian_variants: ...@@ -153,8 +153,8 @@ common_debian_variants:
- Ubuntu - Ubuntu
- Debian - Debian
# Only attempt to use our custom PPA for these releases # We only have to install old Python for these releases:
common_custom_ppa_releases: old_python_ppa_releases:
- precise - precise
- trusty - trusty
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# - downloaded the mysql-apt-repo from the mysql official site(named: mysql-apt-config_0.6.0-1_all.deb) # - 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 # - Find the `debconf` setting information after installing this `deb` package
# #
# # debconf-show mysql-apt-config # # debconf-show mysql-apt-config
# * mysql-apt-config/select-server: mysql-5.6 # * mysql-apt-config/select-server: mysql-5.6
# mysql-apt-config/unsupported-platform: abort # mysql-apt-config/unsupported-platform: abort
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
# * mysql-apt-config/select-product: Apply # * mysql-apt-config/select-product: Apply
# mysql-apt-config/select-tools: # mysql-apt-config/select-tools:
# mysql-apt-config/repo-distro: ubuntu # mysql-apt-config/repo-distro: ubuntu
# #
# - Even to get more information about the `debconf` options of the package: # - Even to get more information about the `debconf` options of the package:
# #
# # debconf-get-selections|grep mysql-apt-config # # 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/select-server select mysql-5.6
# mysql-apt-config mysql-apt-config/unsupported-platform select abort # mysql-apt-config mysql-apt-config/unsupported-platform select abort
...@@ -21,17 +21,17 @@ ...@@ -21,17 +21,17 @@
# mysql-apt-config mysql-apt-config/select-product select Apply # 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/select-tools select
# mysql-apt-config mysql-apt-config/repo-distro select ubuntu # 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` # - After the installation, I have checked the `/etc/apt/sources.list.d` directory and found one file `mysql.list`
# with following contents: # with following contents:
# #
# deb http://repo.mysql.com/apt/ubuntu/ precise mysql-apt-config # deb http://repo.mysql.com/apt/ubuntu/ precise mysql-apt-config
# deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6 # deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6
# deb-src 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. # 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 - name: Add MySQL community apt key
apt_key: apt_key:
...@@ -49,29 +49,22 @@ ...@@ -49,29 +49,22 @@
update_cache: yes update_cache: yes
when: ansible_distribution_release == 'precise' 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 - name: Install mysql-5.6 and dependencies
apt: apt:
name: "{{ item }}" name: "{{ item }}"
install_recommends: yes install_recommends: yes
state: present state: present
with_items: "{{ mysql_debian_pkgs }}" with_items: "{{ mysql_debian_pkgs }}"
- name: Start mysql - name: Start mysql
service: service:
name: mysql name: mysql
state: started state: started
- name: Ensure Anonymous user(s) does not exist - name: Ensure Anonymous user(s) does not exist
mysql_user: mysql_user:
name: '' name: ''
host: "{{ item }}" host: "{{ item }}"
state: absent state: absent
with_items: with_items:
- localhost - localhost
......
...@@ -107,13 +107,9 @@ apt-get install -y software-properties-common python-software-properties ...@@ -107,13 +107,9 @@ apt-get install -y software-properties-common python-software-properties
# Add git PPA # Add git PPA
add-apt-repository -y ppa:git-core/ppa add-apt-repository -y ppa:git-core/ppa
# For older distributions we need to install a PPA for Python 2.7.10 # For older software we need to install our own PPA.
if [[ "precise" = "${SHORT_DIST}" || "trusty" = "${SHORT_DIST}" ]]; then apt-key adv --keyserver "${EDX_PPA_KEY_SERVER}" --recv-keys "${EDX_PPA_KEY_ID}"
add-apt-repository -y "${EDX_PPA}"
# Add python PPA
apt-key adv --keyserver "${EDX_PPA_KEY_SERVER}" --recv-keys "${EDX_PPA_KEY_ID}"
add-apt-repository -y "${EDX_PPA}"
fi
# Install python 2.7 latest, git and other common requirements # Install python 2.7 latest, git and other common requirements
# NOTE: This will install the latest version of python 2.7 and # NOTE: This will install the latest version of python 2.7 and
......
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