Updated role using the Multi-Distro framework

* The default apt packages have been moved into a var file
  that is only loaded when the detected OS is matched.
* The Install task file has had the apt specific tasks moved
  into a named install task file.

Change-Id: Iedc70ee2898c94d326c1a16f2b0064950a7dbd91
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-03-21 21:39:54 -05:00
parent 1f85dbe3e4
commit 0361308dbb
5 changed files with 83 additions and 28 deletions

View File

@ -33,17 +33,6 @@ galera_client_drop_config_file: "{{ inventory_hostname in groups['galera_all'] o
galera_client_apt_repo_url: "https://mirror.rackspace.com/mariadb/repo/10.0/ubuntu"
galera_client_apt_repo: "deb {{ galera_client_apt_repo_url }} {{ ansible_distribution_release }} main"
galera_client_apt_packages:
- libaio1
- libc6
- libdbd-mysql-perl
- libgcc1
- libgcrypt11
- libmariadbclient-dev
- libssl-dev
- libstdc++6
- mariadb-client
galera_client_pip_packages:
- MySQL-python
- python-memcached

View File

@ -13,24 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache
#when https://github.com/ansible/ansible-modules-core/pull/1517 is merged
#in 1.9.x or we move to 2.0 (if tested working)
- name: Check apt last update file
stat:
path: /var/cache/apt
register: apt_cache_stat
- include: galera_client_install_apt.yml
when:
- ansible_pkg_mgr == 'apt'
tags:
- galera-client-apt-packages
- name: Update apt if needed
apt:
update_cache: yes
when: >
"ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or
add_repo | changed
tags:
- galera-client-apt-packages
- install-apt
- name: Install galera packages
apt:

View File

@ -0,0 +1,45 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache
#when https://github.com/ansible/ansible-modules-core/pull/1517 is merged
#in 1.9.x or we move to 2.0 (if tested working)
- name: Check apt last update file
stat:
path: /var/cache/apt
register: apt_cache_stat
tags:
- galera-client-apt-packages
- name: Update apt if needed
apt:
update_cache: yes
when: >
"ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or
add_repo | changed
tags:
- galera-client-apt-packages
- name: Install galera packages
apt:
pkg: "{{ item }}"
state: latest
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: galera_client_apt_packages
tags:
- galera-client-apt-packages

View File

@ -13,6 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- include: galera_client_pre_install.yml
- include: galera_client_install.yml
- include: galera_client_post_install.yml

25
vars/ubuntu-14.04.yml Normal file
View File

@ -0,0 +1,25 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
galera_client_apt_packages:
- libaio1
- libc6
- libdbd-mysql-perl
- libgcc1
- libgcrypt11
- libmariadbclient-dev
- libssl-dev
- libstdc++6
- mariadb-client