Remove references to unsupported operating systems

All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: I42e40adc20a122ea5bba292b1f6fea9e79b3c365
This commit is contained in:
Jonathan Rosser 2021-03-23 16:43:09 +00:00 committed by Dmitriy Rabotyagov
parent f0ed7234cb
commit f1ed3f5dc9
18 changed files with 19 additions and 108 deletions

View File

@ -45,24 +45,12 @@ default_bind_mount_logs: true
# in order to create a more sensible repo name for the distro. # in order to create a more sensible repo name for the distro.
os_distro_version: "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}-{{ ansible_facts['distribution_version'].split('.')[:2] | join('.') }}-{{ ansible_facts['architecture'] | lower }}" os_distro_version: "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}-{{ ansible_facts['distribution_version'].split('.')[:2] | join('.') }}-{{ ansible_facts['architecture'] | lower }}"
# Set the systemd prefix based on the base OS.
systemd_utils_distro_prefix:
apt: "/lib/systemd"
yum: "/lib/systemd"
dnf: "/lib/systemd"
zypper: "/usr/lib/systemd"
systemd_utils_prefix: "{{ systemd_utils_distro_prefix[ansible_facts['pkg_mgr']] }}"
openstack_lock_dir: "/run/lock" openstack_lock_dir: "/run/lock"
# Ensure that the package state matches the global setting # Ensure that the package state matches the global setting
rsyslog_client_package_state: "{{ package_state }}" rsyslog_client_package_state: "{{ package_state }}"
# At this time there's no suitable package available for systemd-journal-remote/gateway rsyslog_client_enabled: False
# When installing on SUSE 42.x. For now this playbook will omit suse when the package rsyslog_server_enabled: False
# manager is "zypper". When a suitable package is available on SUSE this should be removed.
rsyslog_client_enabled: "{{ ansible_facts['pkg_mgr'] == 'zypper' }}"
rsyslog_server_enabled: "{{ ansible_facts['pkg_mgr'] == 'zypper' }}"
# URL for the frozen internal openstack repo. # URL for the frozen internal openstack repo.
repo_server_port: 8181 repo_server_port: 8181

View File

@ -22,7 +22,7 @@ osd_group_name: ceph-osd
rgw_group_name: ceph-rgw rgw_group_name: ceph-rgw
mds_group_name: ceph-mds mds_group_name: ceph-mds
nfs_group_name: ceph-nfs nfs_group_name: ceph-nfs
ceph_origin: "{{ (ansible_facts['pkg_mgr'] == 'zypper') | ternary('distro', 'repository') }}" ceph_origin: repository
ceph_repository: community ceph_repository: community
# The _stable_release var is used by both the OSA ceph_client role and the # The _stable_release var is used by both the OSA ceph_client role and the
# ceph-ansible roles. It is defaulted in ceph_client but set here to keep the # ceph-ansible roles. It is defaulted in ceph_client but set here to keep the

View File

@ -1,6 +1,6 @@
--- ---
ceph_conf_overrides_rgw: ceph_conf_overrides_rgw:
"client.rgw.{{ hostvars[inventory_hostname]['ansible_hostname'] }}.rgw0": "client.rgw.{{ hostvars[inventory_hostname]['ansible_facts']['hostname'] }}.rgw0":
# OpenStack integration with Keystone # OpenStack integration with Keystone
rgw_keystone_url: "{{ keystone_service_adminuri }}" rgw_keystone_url: "{{ keystone_service_adminuri }}"
rgw_keystone_api_version: 3 rgw_keystone_api_version: 3

View File

@ -30,7 +30,7 @@ utility_venv_bin: "/openstack/venvs/utility-{{ openstack_release }}/bin"
utility_distro_packages: utility_distro_packages:
- git - git
- bash-completion - bash-completion
- "{{ (ansible_pkg_mgr == 'apt') | ternary('debianutils', 'which') }}" - "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('debianutils', 'which') }}"
# Distribution packages needed for the utility pip package wheel build # Distribution packages needed for the utility pip package wheel build
_utility_devel_distro_packages_debian: _utility_devel_distro_packages_debian:

View File

@ -63,7 +63,7 @@
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when: when:
- ansible_facts['pkg_mgr'] in ['yum', 'dnf'] - ansible_facts['pkg_mgr'] == 'dnf'
- ansible_facts['service_mgr'] == 'systemd' - ansible_facts['service_mgr'] == 'systemd'
- name: Add systemd override for PrivateDevices - name: Add systemd override for PrivateDevices
@ -73,7 +73,7 @@
[Service] [Service]
PrivateDevices=false PrivateDevices=false
when: when:
- ansible_facts['pkg_mgr'] in ['yum', 'dnf'] - ansible_facts['pkg_mgr'] == 'dnf'
- ansible_facts['service_mgr'] == 'systemd' - ansible_facts['service_mgr'] == 'systemd'
roles: roles:

View File

@ -28,7 +28,7 @@
name: libselinux-python3 name: libselinux-python3
state: present state: present
when: when:
- ansible_facts['pkg_mgr'] in ['yum', 'dnf'] - ansible_facts['pkg_mgr'] == 'dnf'
# Set the priority of the ceph community apt repo either above or below that of UCA or distro sources # Set the priority of the ceph community apt repo either above or below that of UCA or distro sources
- name: Set apt package pins - name: Set apt package pins

View File

@ -29,14 +29,6 @@
name: systemd-journald name: systemd-journald
state: restarted state: restarted
pre_tasks: pre_tasks:
# At this time there's no suitable package available for systemd-journal-remote/gateway
# When installing on SUSE 42.x. For now this playbook will omit suse when the package
# manager is "zypper". When a suitable package is available on SUSE this should be removed.
- name: Omit suse from this playbook
meta: end_play
when:
- ansible_facts['pkg_mgr'] == 'zypper'
- name: Skip playbook if log_hosts group is empty - name: Skip playbook if log_hosts group is empty
meta: end_play meta: end_play
when: when:
@ -104,7 +96,7 @@
enabled: "{{ (ansible_host != systemd_journal_remote_target) | ternary('no', 'yes') }}" enabled: "{{ (ansible_host != systemd_journal_remote_target) | ternary('no', 'yes') }}"
state: "{{ (ansible_host != systemd_journal_remote_target) | ternary('stopped', 'started') }}" state: "{{ (ansible_host != systemd_journal_remote_target) | ternary('stopped', 'started') }}"
execstarts: >- execstarts: >-
{{ systemd_utils_prefix }}/systemd-journal-remote /lib/systemd/systemd-journal-remote
--listen-http=-3 --listen-http=-3
--split-mode=host --split-mode=host
--compress --compress
@ -118,7 +110,7 @@
enabled: "{{ (ansible_host == systemd_journal_remote_target) | ternary('no', 'yes') }}" enabled: "{{ (ansible_host == systemd_journal_remote_target) | ternary('no', 'yes') }}"
state: "{{ (ansible_host == systemd_journal_remote_target) | ternary('stopped', 'started') }}" state: "{{ (ansible_host == systemd_journal_remote_target) | ternary('stopped', 'started') }}"
execstarts: >- execstarts: >-
{{ systemd_utils_prefix }}/systemd-journal-upload /lib/systemd/systemd-journal-upload
--save-state --save-state
--merge --merge
--url=http://{{ systemd_journal_remote_target }}:19532 --url=http://{{ systemd_journal_remote_target }}:19532

View File

@ -88,7 +88,7 @@
package: package:
name: "{{ utility_distro_packages | default([]) }}" name: "{{ utility_distro_packages | default([]) }}"
state: "{{ utility_package_state }}" state: "{{ utility_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}" cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages register: install_packages
until: install_packages is success until: install_packages is success

View File

@ -90,12 +90,6 @@ case ${DISTRO_ID} in
python3-apt python3-venv \ python3-apt python3-venv \
python3-minimal wget python3-minimal wget
;; ;;
opensuse*)
zypper -n install -l git-core curl autoconf gcc gcc-c++ \
netcat-openbsd python python-xml python-devel gcc \
libffi-devel libopenssl-devel python-setuptools \
patterns-devel-python-devel_python3
;;
esac esac
# Load nodepool PIP mirror settings # Load nodepool PIP mirror settings

View File

@ -81,30 +81,15 @@ function repo_information {
[[ "${1}" != "host" ]] && lxc_cmd="lxc-attach --name ${1} --" || lxc_cmd="" [[ "${1}" != "host" ]] && lxc_cmd="lxc-attach --name ${1} --" || lxc_cmd=""
echo "Collecting list of installed packages and enabled repositories for \"${1}\"" echo "Collecting list of installed packages and enabled repositories for \"${1}\""
# Redhat package debugging # Redhat package debugging
if eval sudo ${lxc_cmd} which yum &>/dev/null || eval sudo ${lxc_cmd} which dnf &>/dev/null; then if eval sudo ${lxc_cmd} which dnf &>/dev/null; then
# Prefer dnf over yum for CentOS. eval sudo ${lxc_cmd} dnf repolist -v > "${WORKING_DIR}/logs/redhat-rpm-repolist-${1}-${TS}.txt" || true
eval sudo ${lxc_cmd} which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum' eval sudo ${lxc_cmd} dnf list installed > "${WORKING_DIR}/logs/redhat-rpm-list-installed-${1}-${TS}.txt" || true
eval sudo ${lxc_cmd} $RHT_PKG_MGR repolist -v > "${WORKING_DIR}/logs/redhat-rpm-repolist-${1}-${TS}.txt" || true
eval sudo ${lxc_cmd} $RHT_PKG_MGR list installed > "${WORKING_DIR}/logs/redhat-rpm-list-installed-${1}-${TS}.txt" || true
# SUSE package debugging
elif eval sudo ${lxc_cmd} which zypper &>/dev/null; then
eval sudo ${lxc_cmd} zypper lr -d > "${WORKING_DIR}/logs/suse-zypper-repolist-${1}-${TS}.txt" || true
eval sudo ${lxc_cmd} zypper --disable-repositories pa -i > "${WORKING_DIR}/logs/suse-zypper-list-installed-${1}-${TS}.txt" || true
# Ubuntu package debugging # Ubuntu package debugging
elif eval sudo ${lxc_cmd} which apt-get &> /dev/null; then elif eval sudo ${lxc_cmd} which apt-get &> /dev/null; then
eval sudo ${lxc_cmd} apt-cache policy | grep http | awk '{print $1" "$2" "$3}' | sort -u > "${WORKING_DIR}/logs/ubuntu-apt-repolist-${1}-${TS}.txt" || true eval sudo ${lxc_cmd} apt-cache policy | grep http | awk '{print $1" "$2" "$3}' | sort -u > "${WORKING_DIR}/logs/ubuntu-apt-repolist-${1}-${TS}.txt" || true
eval sudo ${lxc_cmd} apt list --installed > "${WORKING_DIR}/logs/ubuntu-apt-list-installed-${1}-${TS}.txt" || true eval sudo ${lxc_cmd} apt list --installed > "${WORKING_DIR}/logs/ubuntu-apt-list-installed-${1}-${TS}.txt" || true
# Gentoo package debugging
elif eval sudo ${lxc_cmd} which emerge &> /dev/null; then
# list installed packages
eval sudo ${lxc_cmd} equery list "*" > "${WORKING_DIR}/logs/gentoo-portage-list-installed-${1}-${TS}.txt" || true
# list only packages called for install (not dependancies)
eval sudo ${lxc_cmd} cat /var/lib/portage/world > "${WORKING_DIR}/logs/gentoo-portage-list-manual-installed-${1}-${TS}.txt" || true
fi fi
} }
function store_artifacts { function store_artifacts {

View File

@ -217,9 +217,6 @@ function run_dstat {
apt-get update apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install dstat DEBIAN_FRONTEND=noninteractive apt-get -y install dstat
;; ;;
opensuse)
zypper -n install -l dstat
;;
esac esac
# https://stackoverflow.com/a/20338327 executing in ()& decouples the dstat # https://stackoverflow.com/a/20338327 executing in ()& decouples the dstat
@ -334,7 +331,7 @@ function get_instance_info {
determine_distro determine_distro
case ${DISTRO_ID} in case ${DISTRO_ID} in
centos|rhel|fedora|opensuse) centos|rhel)
rpm -qa | sort > \ rpm -qa | sort > \
"/openstack/log/instance-info/host_packages_info_${TS}.log" || true "/openstack/log/instance-info/host_packages_info_${TS}.log" || true
;; ;;

View File

@ -26,9 +26,7 @@
vars: vars:
sftp_subsystem: sftp_subsystem:
'apt': 'sftp /usr/lib/openssh/sftp-server' 'apt': 'sftp /usr/lib/openssh/sftp-server'
'yum': 'sftp /usr/libexec/openssh/sftp-server'
'dnf': 'sftp /usr/libexec/openssh/sftp-server' 'dnf': 'sftp /usr/libexec/openssh/sftp-server'
'zypper': 'sftp /usr/lib/ssh/sftp-server'
sshd: sshd:
ListenAddress: ListenAddress:
- 0.0.0.0 - 0.0.0.0

View File

@ -118,18 +118,10 @@ bootstrap_host_network_utils:
iptables: /sbin/iptables iptables: /sbin/iptables
ethtool: /sbin/ethtool ethtool: /sbin/ethtool
ip: /sbin/ip ip: /sbin/ip
yum:
iptables: /usr/sbin/iptables
ethtool: /usr/sbin/ethtool
ip: /usr/sbin/ip
dnf: dnf:
iptables: /usr/sbin/iptables iptables: /usr/sbin/iptables
ethtool: /usr/sbin/ethtool ethtool: /usr/sbin/ethtool
ip: /usr/sbin/ip ip: /usr/sbin/ip
zypper:
iptables: /usr/sbin/iptables
ethtool: /sbin/ethtool
ip: /sbin/ip
# #
bootstrap_host_iptables_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['iptables'] }}" bootstrap_host_iptables_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['iptables'] }}"
bootstrap_host_ethtool_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['ethtool'] }}" bootstrap_host_ethtool_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['ethtool'] }}"

View File

@ -24,7 +24,7 @@
package: package:
name: "{{ packages_install }}" name: "{{ packages_install }}"
state: present state: present
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
tags: tags:
- install-packages - install-packages

View File

@ -17,7 +17,7 @@
package: package:
name: "{{ packages_install_zfs }}" name: "{{ packages_install_zfs }}"
state: present state: present
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
tags: tags:
- install-packages - install-packages

View File

@ -17,7 +17,7 @@
package: package:
name: squid name: squid
state: present state: present
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
notify: Restart squid notify: Restart squid
tags: tags:
- install-packages - install-packages

View File

@ -1,35 +0,0 @@
---
# Copyright 2015, 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.
packages_install:
- bridge-utils
- btrfsprogs
- curl
- dbus-1
- ethtool
- git-core
- iptables
- lvm2
- python3
- python3-devel
- vim
- vlan
- xfsprogs
packages_remove: []
rc_local: /etc/rc.d/boot.local
rc_local_insert_before: EOF

View File

@ -28,7 +28,7 @@
regexp: 'https' regexp: 'https'
replace: "http" replace: "http"
when: when:
- ansible_distribution_release in ['focal'] - ansible_facts['distribution_release'] in ['focal']
- name: Remove package excludes for yum/dnf - name: Remove package excludes for yum/dnf
lineinfile: lineinfile: