Add support for the openSUSE Leap distributions

Add support for the openSUSE Leap distributions. Nothing special is
required for this except for adding the appropriate distro variables
file and also update the zypper cache before package installation.
Moreover, for tests to pass, we need to use the OBS repository to
install the MongoDB packages since they are not provided in the default
openSUSE distribution repositories for Leap < 42.3

Change-Id: Ifa3968f7f578174cf12737c758fa2bca30393fb0
This commit is contained in:
Markos Chandras 2017-07-06 13:24:00 +01:00
parent 1d25146bee
commit 15ca22d4e0
4 changed files with 55 additions and 8 deletions

View File

@ -23,6 +23,14 @@ galaxy_info:
- name: Ubuntu
versions:
- xenial
- name: EL
versions:
- 7
- name: opensuse
versions:
- 42.1
- 42.2
- 42.3
categories:
- cloud
- python

View File

@ -17,7 +17,7 @@
package:
name: "{{ item }}"
state: "{{ ceilometer_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages|success
@ -29,7 +29,7 @@
package:
name: "{{ item }}"
state: "{{ ceilometer_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages|success

View File

@ -23,6 +23,18 @@
- pip
tasks:
# NOTE(hwoarang) MongoDB is available on openSUSE Leap >= 42.3. For older
# versions we need to add the OBS repository
- name: Install MongoDB repository (SUSE)
zypper_repository:
auto_import_keys: yes
name: "OBS:server_database"
repo: "http://download.opensuse.org/repositories/server:/database/openSUSE_Leap_{{ ansible_distribution_version }}"
runrefresh: yes
when:
- ansible_pkg_mgr == 'zypper'
- ansible_distribution_version | version_compare('42.3', '<')
- name: Install mongo packages
package:
state: present
@ -38,17 +50,17 @@
- python-pymongo
when: ansible_pkg_mgr == 'apt'
- name: Install client package (CentOS)
- name: Install client package (rpm)
package:
state: present
name: mongodb
when: ansible_pkg_mgr == 'yum'
when: ansible_pkg_mgr in ['yum', 'zypper']
- name: Install pip package (CentOS)
- name: Install pip package (rpm)
pip:
state: latest
name: pymongo
when: ansible_pkg_mgr == 'yum'
when: ansible_pkg_mgr in ['yum', 'zypper']
- name: Configure the MongoDB
template:
@ -101,7 +113,7 @@
vars:
packages_mongodb:
- mongodb-server
mongodb_config_file: "{{ (ansible_pkg_mgr == 'apt') | ternary('/etc/mongodb.conf','/etc/mongod.conf') }}"
mongodb_service_name: "{{ (ansible_pkg_mgr == 'apt') | ternary('mongodb','mongod') }}"
mongodb_config_file: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('/etc/mongodb.conf','/etc/mongod.conf') }}"
mongodb_service_name: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('mongodb','mongod') }}"
ceilometer_database_name: ceilometer
ceilometer_database_user: ceilometer

27
vars/suse-42.yml Normal file
View File

@ -0,0 +1,27 @@
---
# Copyright 2014, Rackspace US, Inc.
# Copyright 2017, SUSE LINUX GmbH.
#
# 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.
ceilometer_distro_packages:
- git-core
- rpcbind
- rsync
- which
# Packages required in developer mode, where packages are built locally
ceilometer_developer_mode_distro_packages:
- libvirt-devel
- libxml2-devel
- libxslt-devel