Updating os_zaqar to use 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: Id95826a9dd9e5d2ed83a95c3f02d18929735a8f2 Implements: blueprint multi-platform-host
This commit is contained in:
parent
4a93988f56
commit
8a6f23e8de
|
@ -5,6 +5,8 @@ OpenStack-Ansible Zaqar
|
|||
|
||||
This Ansible role installs and configures OpenStack Zaqar.
|
||||
|
||||
Linux Distribution Support: Ubuntu 14.04
|
||||
|
||||
Default Variables
|
||||
=================
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
## Verbosity Option
|
||||
debug: False
|
||||
|
||||
## APT Cache options
|
||||
cache_timeout: 600
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
zaqar_venv_tag: untagged
|
||||
zaqar_venv_bin: "/openstack/venvs/zaqar-{{ zaqar_venv_tag }}/bin"
|
||||
|
@ -116,17 +113,6 @@ zaqar_secret_key: notreallysecret
|
|||
zaqar_enable_notification: false
|
||||
zaqar_unreliable: true
|
||||
|
||||
# Common apt packages
|
||||
zaqar_apt_packages:
|
||||
- gcc
|
||||
- libxml2-dev
|
||||
- libxslt1-dev
|
||||
- python-dev
|
||||
- zlib1g-dev
|
||||
- apache2
|
||||
- nginx
|
||||
- libapache2-mod-wsgi
|
||||
|
||||
# zaqar packages that must be installed before anything else
|
||||
zaqar_requires_pip_packages:
|
||||
- virtualenv
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
# will potentially be detrimental to the tests executed.
|
||||
|
||||
# Requirements for Paramiko 2.0
|
||||
libssl-dev
|
||||
libffi-dev
|
||||
libssl-dev [platform:dpkg]
|
||||
libffi-dev [platform:dpkg]
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
# 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)
|
||||
#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:
|
||||
- zaqar-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_repos | changed
|
||||
|
||||
- name: Install zaqar apt packages
|
||||
apt:
|
||||
pkg: "{{ item }}"
|
||||
state: latest
|
||||
register: install_apt_packages
|
||||
until: install_apt_packages | success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: zaqar_apt_packages
|
||||
tags:
|
||||
- zaqar-apt-packages
|
||||
|
|
@ -13,6 +13,16 @@
|
|||
# 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_release | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- include: zaqar_pre_install.yml
|
||||
- include: zaqar_install.yml
|
||||
- include: zaqar_post_install.yml
|
||||
|
|
|
@ -12,19 +12,11 @@
|
|||
# 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.
|
||||
- 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:
|
||||
- zaqar-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:
|
||||
- zaqar-apt-packages
|
||||
- install-apt
|
||||
|
||||
- name: Create developer mode constraint file
|
||||
copy:
|
||||
|
@ -66,19 +58,6 @@
|
|||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
|
||||
- name: Install apt packages
|
||||
apt:
|
||||
pkg: "{{ item }}"
|
||||
state: latest
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: zaqar_apt_packages
|
||||
tags:
|
||||
- zaqar-install
|
||||
- zaqar-apt-packages
|
||||
|
||||
- name: Install requires pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# Copyright 2016, Rackspace, 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
|
||||
|
||||
zaqar_apt_packages:
|
||||
- gcc
|
||||
- libxml2-dev
|
||||
- libxslt1-dev
|
||||
- libpython-dev
|
||||
- python2.7-dev
|
||||
- python-dev
|
||||
- zlib1g-dev
|
||||
- apache2
|
||||
- nginx
|
||||
- libapache2-mod-wsgi
|
Loading…
Reference in New Issue