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: Idbf1b737a11b0bb2460989b2881395ee87a90429
Implements: blueprint multi-platform-host
This commit is contained in:
Jimmy McCrory 2016-05-26 18:33:25 -07:00
parent c8be25c5d5
commit bacac18263
7 changed files with 88 additions and 39 deletions

View File

@ -62,18 +62,6 @@ magnum_service_project_domain_name: Default
magnum_service_user_domain_name: default
magnum_service_project_name: service
magnum_apt_packages:
- python-dev
- libssl-dev
- libxml2-dev
# - libmysqlclient-dev
- libxslt-dev
- libpq-dev
- git
- libffi-dev
- gettext
- build-essential
magnum_pip_packages:
- Babel
- PrettyTable

View File

@ -18,7 +18,9 @@ galaxy_info:
- python
- magnum
dependencies:
- apt_package_pinning
- role: apt_package_pinning
when:
- ansible_pkg_mgr == 'apt'
- galera_client
- pip_install
- pip_lock_down

View File

@ -13,30 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Update apt sources
apt:
update_cache: "yes"
cache_valid_time: "600"
register: apt_update
until: apt_update |success
retries: 5
delay: 2
- include: magnum_install_apt.yml
when:
- ansible_pkg_mgr == 'apt'
tags:
- magnum-apt-packages
- magnum-apt-sources
- magnum-install
- name: Install apt packages for Magnum
apt:
pkg: "{{ item }}"
state: "latest"
register: install_magnum_apt_packages
until: install_magnum_apt_packages |success
retries: 5
delay: 2
with_items: "{{ magnum_apt_packages }}"
tags:
- magnum-apt-packages
- magnum-install
- name: Install pip packages for Magnum

View File

@ -0,0 +1,43 @@
---
# Copyright 2016, Walmart Stores, 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:
- magnum-apt-sources
- name: Update apt if needed
apt:
update_cache: yes
when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}"
tags:
- magnum-apt-sources
- name: Install apt packages for Magnum
apt:
pkg: "{{ item }}"
state: "latest"
register: install_magnum_apt_packages
until: install_magnum_apt_packages |success
retries: 5
delay: 2
with_items: "{{ magnum_apt_packages }}"
tags:
- magnum-apt-packages

View File

@ -13,7 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Main tasks file for openstack-ansible-magnum
- 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 }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- include: pre-install.yml

30
vars/debian.yml Normal file
View File

@ -0,0 +1,30 @@
---
# Copyright 2016, Walmart Stores, 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.
## APT Cache options
cache_timeout: 600
# Common apt packages
magnum_apt_packages:
- python-dev
- libssl-dev
- libxml2-dev
- libmysqlclient-dev
- libxslt-dev
- libpq-dev
- git
- libffi-dev
- gettext
- build-essential

View File

@ -1,2 +0,0 @@
---
# vars file for openstack-ansible-magnum