Multi-distro pattern for os_heat role

This is an implementation of a pattern for multi-distro support

This allows for support of distros other than Ubuntu

Change-Id: I1b53521570bd71bdca3d482345403bbc8133df7b
This commit is contained in:
Travis Truman 2016-05-02 10:10:20 -04:00
parent 8ab8ba131c
commit c05704194b
5 changed files with 75 additions and 32 deletions

View File

@ -175,10 +175,6 @@ heat_plugin_dirs:
# "cloudformation:ListStacks": "rule:deny_stack_user"
# "cloudformation:CreateStack": "rule:deny_stack_user"
heat_apt_packages:
- rsync
- libxslt1.1
# Heat packages that must be installed before anything else
heat_requires_pip_packages:
- virtualenv

View File

@ -13,22 +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: install-apt.yml
when:
- ansible_pkg_mgr == 'apt'
tags:
- heat-apt-packages
- name: Update apt if needed
apt:
update_cache: yes
when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}"
tags:
- heat-apt-packages
- install-apt
- name: Create developer mode constraint file
copy:
@ -74,19 +63,6 @@
- heat-install
- heat-pip-packages
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ heat_apt_packages }}"
tags:
- heat-install
- heat-apt-packages
- name: Install requires pip packages
pip:
name: "{{ item }}"

44
tasks/install-apt.yml Normal file
View File

@ -0,0 +1,44 @@
---
# Copyright 2014, 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:
- heat-apt-packages
- name: Update apt if needed
apt:
update_cache: yes
when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}"
tags:
- heat-apt-packages
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ heat_apt_packages }}"
tags:
- heat-install
- heat-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: heat_pre_install.yml
- include: heat_install.yml
- include: heat_post_install.yml

18
vars/debian.yml Normal file
View File

@ -0,0 +1,18 @@
---
# Copyright 2014, 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.
heat_apt_packages:
- rsync
- libxslt1.1