Add release pinning to galera roles

As both Ubuntu and the MariaDB repositories carry packages with the same
names, apt package pinning is required to ensure that the packages we install
come from the right repository. This patch adds a pinning preference file to
ensure that the packages we install come from the MariaDB repository.

Due to the OpenStack CI images having conflicting packages installed in the
base image, this patch also includes the removal of these packages during the
AIO bootstrap to ensure that the deployment succeeds.

For environments where the same two packages are installed on the hosts prior
to the deployment of os-ansible-deployment, they would need to ensure that the
packages are removed first. This has been seen in environments where
monitoring tooling has installed the packages as a dependancy.

Closes-Bug: #1446772
Change-Id: I5ad0b9010e49832c4f866c0b141e1c035d5f9268
This commit is contained in:
Kevin Carter 2015-04-21 18:02:50 -05:00 committed by Jesse Pretorius
parent 67d6361a1c
commit 886fe01edb
7 changed files with 48 additions and 11 deletions

View File

@ -25,8 +25,10 @@ galera_client_gpg_keys:
hash_id: '0xcbcb082a1bb943db'
# Repositories
galera_client_apt_repos:
- { repo: "deb http://mirror.rackspace.com/mariadb/repo/5.5/ubuntu {{ ansible_distribution_release }} main", state: "present" }
galera_client_apt_repo_url: "http://mirror.rackspace.com/mariadb/repo/5.5/ubuntu"
galera_client_apt_repo:
repo: "deb {{ galera_client_apt_repo_url }} {{ ansible_distribution_release }} main"
state: "present"
galera_client_apt_packages:
- libmariadbclient-dev

View File

@ -40,11 +40,20 @@
tags:
- galera-client-apt-keys
- name: Drop galera repo pin
template:
src: "galera_client_pin.pref.j2"
dest: "/etc/apt/preferences.d/galera_client_pin.pref"
owner: "root"
group: "root"
mode: "0644"
tags:
- galera-client-repo-pin
- name: Add galera repo(s)
apt_repository:
repo: "{{ item.repo }}"
state: "{{ item.state }}"
with_items: galera_client_apt_repos
repo: "{{ galera_client_apt_repo.repo }}"
state: "{{ galera_client_apt_repo.state }}"
register: add_repos
until: add_repos|success
retries: 5

View File

@ -0,0 +1,5 @@
# {{ ansible_managed }}
Package: *
Pin: release o=MariaDB
Pin-Priority: 1001

View File

@ -52,8 +52,10 @@ galera_gpg_keys:
hash_id: '0xcbcb082a1bb943db'
# Repositories
galera_apt_repos:
- { repo: "deb http://mirror.rackspace.com/mariadb/repo/5.5/ubuntu {{ ansible_distribution_release }} main", state: "present" }
galera_apt_repo_url: "http://mirror.rackspace.com/mariadb/repo/5.5/ubuntu"
galera_apt_repo:
repo: "deb {{ galera_apt_repo_url }} {{ ansible_distribution_release }} main"
state: "present"
galera_pip_packages:
- MySQL-python

View File

@ -55,11 +55,20 @@
tags:
- galera-apt-keys
- name: Drop galera repo pin
template:
src: "galera_pin.pref.j2"
dest: "/etc/apt/preferences.d/galera_pin.pref"
owner: "root"
group: "root"
mode: "0644"
tags:
- galera-repo-pin
- name: Add galera repo(s)
apt_repository:
repo: "{{ item.repo }}"
state: "{{ item.state }}"
with_items: galera_apt_repos
repo: "{{ galera_apt_repo.repo }}"
state: "{{ galera_apt_repo.state }}"
register: add_repos
until: add_repos|success
retries: 5

View File

@ -0,0 +1,5 @@
# {{ ansible_managed }}
Package: *
Pin: release o=MariaDB
Pin-Priority: 1001

View File

@ -86,8 +86,13 @@ if [ ! "$(grep -e '^nameserver 8.8.8.8' -e '^nameserver 8.8.4.4' /etc/resolv.con
echo -e '\n# Adding google name servers\nnameserver 8.8.8.8\nnameserver 8.8.4.4' | tee -a /etc/resolv.conf
fi
# Update the package cache and install required packages
# Update the package cache
apt-get update
# Remove known conflicting packages in the base image
apt-get purge -y libmysqlclient18 mysql-common
# Install required packages
apt-get install -y python-dev \
python2.7 \
build-essential \