Add SUSE support
Add support for SUSE based distributions Change-Id: Ib57cceeb9af4d1d0232a20622ad6efdba4cc346d
This commit is contained in:
parent
c06fd15bbd
commit
58e17aa13e
38
Vagrantfile
vendored
38
Vagrantfile
vendored
@ -1,8 +1,34 @@
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "ubuntu/xenial64"
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
sudo su -
|
||||
cd /vagrant
|
||||
./run_tests.sh
|
||||
SHELL
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
|
||||
config.vm.define "ubuntu1604" do |xenial|
|
||||
xenial.vm.box = "ubuntu/xenial64"
|
||||
xenial.vm.provision "shell", inline: <<-SHELL
|
||||
sudo su -
|
||||
cd /vagrant
|
||||
./run_tests.sh
|
||||
SHELL
|
||||
end
|
||||
|
||||
config.vm.define "opensuse421" do |leap421|
|
||||
leap421.vm.box = "opensuse/openSUSE-42.1-x86_64"
|
||||
leap421.vm.provision "shell", inline: <<-SHELL
|
||||
sudo su -
|
||||
cd /vagrant
|
||||
./run_tests.sh
|
||||
SHELL
|
||||
end
|
||||
|
||||
config.vm.define "centos7" do |centos7|
|
||||
centos7.vm.box = "centos/7"
|
||||
centos7.vm.provision "shell", inline: <<-SHELL
|
||||
sudo su -
|
||||
cd /vagrant
|
||||
./run_tests.sh
|
||||
SHELL
|
||||
end
|
||||
|
||||
end
|
||||
|
32
bindep.txt
32
bindep.txt
@ -3,12 +3,24 @@
|
||||
#
|
||||
# See the following for details:
|
||||
# - http://docs.openstack.org/infra/bindep/
|
||||
# - https://github.com/openstack-infra/bindep
|
||||
# - https://git.openstack.org/cgit/openstack-infra/bindep
|
||||
#
|
||||
# Even if the role does not make use of this facility, it
|
||||
# is better to have this file empty, otherwise OpenStack-CI
|
||||
# will fall back to installing its default packages which
|
||||
# will potentially be detrimental to the tests executed.
|
||||
#
|
||||
# Note:
|
||||
# This file is maintained in the openstack-ansible-tests repository.
|
||||
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/bindep.txt
|
||||
# If you need to remove or add extra dependencies, you should modify
|
||||
# the central file instead and once your change is accepted then update
|
||||
# this file as well. The purpose of this file is to ensure that Python and
|
||||
# Ansible have all their necessary binary requirements on the test host before
|
||||
# tox executes. Any binary requirements needed by services/roles should be
|
||||
# installed by those roles in their applicable package install tasks, not through
|
||||
# using this file.
|
||||
#
|
||||
|
||||
# Base requirements for Ubuntu
|
||||
build-essential [platform:dpkg]
|
||||
@ -18,24 +30,26 @@ libffi-dev [platform:dpkg]
|
||||
python2.7 [platform:dpkg]
|
||||
python-dev [platform:dpkg]
|
||||
|
||||
# Base requirements for CentOS
|
||||
# Base requirements for RPM distros
|
||||
gcc [platform:rpm]
|
||||
gcc-c++ [platform:rpm]
|
||||
git [platform:rpm]
|
||||
python-devel [platform:rpm]
|
||||
libffi-devel [platform:rpm]
|
||||
openssl-devel [platform:rpm]
|
||||
python-devel [platform:rpm]
|
||||
|
||||
# For SELinux
|
||||
libselinux-python [platform:rpm]
|
||||
libselinux-python [platform:centos]
|
||||
libsemanage-python [platform:centos]
|
||||
|
||||
# For SSL SNI support
|
||||
python-pyasn1 [platform:dpkg]
|
||||
python-openssl [platform:dpkg]
|
||||
python-pyasn1 [platform:dpkg platform:suselinux]
|
||||
python-openssl [platform:dpkg platform:suselinux]
|
||||
python-ndg-httpsclient [platform:ubuntu]
|
||||
python2-pyasn1 [platform:rpm]
|
||||
python2-pyOpenSSL [platform:rpm]
|
||||
python-ndg_httpsclient [platform:rpm]
|
||||
python2-pyasn1 [platform:centos]
|
||||
python2-pyOpenSSL [platform:centos]
|
||||
python-pyOpenSSL [platform:suselinux]
|
||||
python-ndg_httpsclient [platform:centos]
|
||||
|
||||
# Required for compressing collected log files in CI
|
||||
gzip
|
||||
|
10
files/memcached.service.suse
Normal file
10
files/memcached.service.suse
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=memcached daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/sysconfig/memcached
|
||||
ExecStart=/usr/sbin/memcached -u $MEMCACHED_USER $MEMCACHED_PARAMS
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -26,6 +26,9 @@ galaxy_info:
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
- name: opensuse
|
||||
versions:
|
||||
- all
|
||||
categories:
|
||||
- cloud
|
||||
- memcached
|
||||
|
77
run_tests.sh
77
run_tests.sh
@ -13,62 +13,35 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -xeuo pipefail
|
||||
set -xeu
|
||||
|
||||
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
|
||||
source /etc/os-release || /usr/lib/os-release
|
||||
|
||||
# Install python2 for Ubuntu 16.04 and CentOS 7
|
||||
if which apt-get; then
|
||||
sudo apt-get update && sudo apt-get install -y python
|
||||
fi
|
||||
install_pkg_deps() {
|
||||
pkg_deps="git"
|
||||
|
||||
if which yum; then
|
||||
sudo yum install -y python
|
||||
fi
|
||||
case ${ID,,} in
|
||||
*suse*) pkg_mgr_cmd="zypper -n in" ;;
|
||||
centos|rhel) pkg_mgr_cmd="yum install -y" ;;
|
||||
fedora) pkg_mgr_cmd="dnf -y install" ;;
|
||||
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
|
||||
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Install pip.
|
||||
if ! which pip; then
|
||||
curl --silent --show-error --retry 5 \
|
||||
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
|
||||
fi
|
||||
eval sudo $pkg_mgr_cmd $pkg_deps
|
||||
}
|
||||
|
||||
# Install bindep and tox with pip.
|
||||
sudo pip install bindep tox
|
||||
|
||||
# CentOS 7 requires two additional packages:
|
||||
# redhat-lsb-core - for bindep profile support
|
||||
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
|
||||
if which yum; then
|
||||
sudo yum -y install redhat-lsb-core epel-release
|
||||
fi
|
||||
|
||||
# Get a list of packages to install with bindep. If packages need to be
|
||||
# installed, bindep exits with an exit code of 1.
|
||||
BINDEP_PKGS=$(bindep -b -f bindep.txt test || true)
|
||||
echo "Packages to install: ${BINDEP_PKGS}"
|
||||
|
||||
# Install a list of OS packages provided by bindep.
|
||||
if which apt-get; then
|
||||
sudo apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
|
||||
--assume-yes install $BINDEP_PKGS
|
||||
elif which yum; then
|
||||
# Don't run yum with an empty list of packages.
|
||||
# It will fail and cause the script to exit with an error.
|
||||
if [[ ${#BINDEP_PKGS} > 0 ]]; then
|
||||
sudo yum install -y $BINDEP_PKGS
|
||||
git_clone_repo() {
|
||||
if [[ ! -d tests/common ]]; then
|
||||
git clone https://git.openstack.org/openstack/openstack-ansible-tests tests/common
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Loop through each tox environment and run tests.
|
||||
for tox_env in $(awk -F= '/envlist/ { gsub(",", " "); print $2 }' tox.ini); do
|
||||
echo "Executing tox environment: ${tox_env}"
|
||||
if [[ ${tox_env} == ansible-functional ]]; then
|
||||
if ${FUNCTIONAL_TEST}; then
|
||||
tox -e ${tox_env}
|
||||
fi
|
||||
else
|
||||
tox -e ${tox_env}
|
||||
fi
|
||||
done
|
||||
install_pkg_deps
|
||||
|
||||
git_clone_repo
|
||||
|
||||
# start executing the main test script
|
||||
source tests/common/run_tests.sh
|
||||
|
||||
# vim: set ts=4 sw=4 expandtab:
|
||||
|
35
tasks/install-zypper.yml
Normal file
35
tasks/install-zypper.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
- name: Install zypper packages
|
||||
zypper:
|
||||
name: "{{ item }}"
|
||||
state: "{{ memcached_package_state }}"
|
||||
register: install_zypper_packages
|
||||
until: install_zypper_packages | success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ memcached_distro_packages }}"
|
||||
|
||||
- name: Install zypper packages for testing
|
||||
zypper:
|
||||
name: "{{ item }}"
|
||||
state: "{{ memcached_package_state }}"
|
||||
register: install_zypper_test_packages
|
||||
until: install_zypper_test_packages | success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ memcached_test_distro_packages }}"
|
||||
when: install_test_packages|bool
|
@ -40,6 +40,16 @@
|
||||
mode: "0644"
|
||||
notify: Restart memcached
|
||||
|
||||
- name: Override systemd service file
|
||||
copy:
|
||||
src: "{{ memcached_systemd_service }}"
|
||||
dest: "/etc/systemd/system/memcached.service"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
when: memcached_systemd_service is defined
|
||||
notify: Restart memcached
|
||||
|
||||
- name: Create memcached systemd service config dir
|
||||
file:
|
||||
path: "/etc/systemd/system/memcached.service.d"
|
||||
|
@ -13,12 +13,5 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: install-apt.yml
|
||||
- include: install-{{ ansible_pkg_mgr }}.yml
|
||||
static: no
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
|
||||
- include: install-yum.yml
|
||||
static: no
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
|
29
templates/memcached.suse.j2
Normal file
29
templates/memcached.suse.j2
Normal file
@ -0,0 +1,29 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% if debug | bool %}
|
||||
{% set _verbosity = '-vvv' %}
|
||||
{% else %}
|
||||
{% set _verbosity = '-v' %}
|
||||
{% endif %}
|
||||
|
||||
MEMCACHED_PARAMS="-l {{ memcached_listen }} -p {{ memcached_port }} -c {{ memcached_connections }} -t {{ memcached_threads }} {{ _verbosity }}"
|
||||
|
||||
## Path: Network/WWW/Memcached
|
||||
## Description: username memcached should run as
|
||||
## Type: string
|
||||
## Default: "memcached"
|
||||
## Config: memcached
|
||||
#
|
||||
# username memcached should run as
|
||||
#
|
||||
MEMCACHED_USER="{{ memcached_user }}"
|
||||
|
||||
## Path: Network/WWW/Memcached
|
||||
## Description: group memcached should be run as
|
||||
## Type: string
|
||||
## Default: "memcached"
|
||||
## Config: memcached
|
||||
#
|
||||
# group memcached should be run as
|
||||
#
|
||||
MEMCACHED_GROUP="memcached"
|
28
vars/suse.yml
Normal file
28
vars/suse.yml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
memcached_user: memcached
|
||||
|
||||
memcached_distro_packages:
|
||||
- memcached
|
||||
|
||||
memcached_test_distro_packages:
|
||||
- netcat-openbsd
|
||||
|
||||
memcached_conf_template: memcached.suse.j2
|
||||
|
||||
memcached_systemd_service: memcached.service.suse
|
||||
|
||||
memcached_conf_dest: /etc/sysconfig/memcached
|
Loading…
Reference in New Issue
Block a user