Add dnf support
This patch adds dnf support for CentOS. Implements: blueprint centos-and-dnf Change-Id: I0609d79e98d773af8e431bd520b04a2c893211bc
This commit is contained in:
parent
3b1aa8a82e
commit
354eb1ac81
@ -39,12 +39,12 @@
|
||||
# checking for local packages. The RDO repository package isn't signed, but the
|
||||
# repos it installs have GPG checking enabled.
|
||||
- name: Install the RDO release package
|
||||
yum:
|
||||
package:
|
||||
name: "https://repos.fedorapeople.org/repos/openstack/openstack-ocata/rdo-release-ocata.rpm"
|
||||
state: "present"
|
||||
disable_gpg_check: yes
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
- name: Set the files to copy into the container cache for OpenStack-CI instances
|
||||
set_fact:
|
||||
|
@ -35,9 +35,12 @@ source /etc/os-release || source /usr/lib/os-release
|
||||
install_pkg_deps() {
|
||||
pkg_deps="git"
|
||||
|
||||
# Prefer dnf over yum for CentOS.
|
||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||
|
||||
case ${ID,,} in
|
||||
*suse*) pkg_mgr_cmd="zypper -n in" ;;
|
||||
centos|rhel) pkg_mgr_cmd="yum install -y" ;;
|
||||
centos|rhel) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
|
||||
fedora) pkg_mgr_cmd="dnf -y install" ;;
|
||||
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
|
||||
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
|
||||
|
@ -20,6 +20,9 @@ BINDEP_FILE=${BINDEP_FILE:-bindep.txt}
|
||||
|
||||
source /etc/os-release || source /usr/lib/os-release
|
||||
|
||||
# Prefer dnf over yum for CentOS.
|
||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||
|
||||
case "${ID,,}" in
|
||||
*suse*)
|
||||
# Need to pull libffi and python-pyOpenSSL early
|
||||
@ -28,7 +31,7 @@ case "${ID,,}" in
|
||||
sudo zypper -n in python-devel lsb-release ${extra_suse_deps:-}
|
||||
;;
|
||||
amzn|centos|rhel)
|
||||
sudo yum install -y python-devel redhat-lsb-core
|
||||
sudo $RHT_PKG_MGR install -y python-devel redhat-lsb-core
|
||||
;;
|
||||
ubuntu|debian)
|
||||
sudo apt-get update && sudo apt-get install -y python-dev lsb-release
|
||||
@ -51,7 +54,7 @@ sudo pip install 'bindep>=2.4.0' tox
|
||||
# redhat-lsb-core - for bindep profile support
|
||||
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
|
||||
if [[ ${ID,,} == "centos" ]]; then
|
||||
sudo yum -y install redhat-lsb-core epel-release yum-utils
|
||||
sudo $RHT_PKG_MGR -y install redhat-lsb-core epel-release yum-utils
|
||||
# epel-release could be installed but not enabled (which is very common
|
||||
# in openstack-ci) so enable it here if needed
|
||||
sudo yum-config-manager --enable epel || true
|
||||
@ -72,7 +75,7 @@ if [[ ${#BINDEP_PKGS} > 0 ]]; then
|
||||
sudo zypper -n in $BINDEP_PKGS
|
||||
;;
|
||||
centos)
|
||||
sudo yum install -y $BINDEP_PKGS
|
||||
sudo $RHT_PKG_MGR install -y $BINDEP_PKGS
|
||||
;;
|
||||
ubuntu|debian)
|
||||
sudo apt-get update
|
||||
|
@ -105,7 +105,7 @@ function gate_job_exit_tasks {
|
||||
# NOTE(mhayden): CentOS images in the gate have several slow mirrors enabled
|
||||
# by default. This step ensures that only the base, epel, and updates
|
||||
# repositories are enabled.
|
||||
if which yum &>/dev/null; then
|
||||
if which yum &>/dev/null || which dnf &>/dev/null; then
|
||||
sudo yum-config-manager --disable \*
|
||||
sudo yum-config-manager --enable base
|
||||
sudo yum-config-manager --enable epel
|
||||
|
@ -24,6 +24,7 @@
|
||||
vars:
|
||||
kernel_module_path:
|
||||
apt: "lib/modules"
|
||||
dnf: "usr/lib/modules"
|
||||
yum: "usr/lib/modules"
|
||||
zypper: "lib/modules"
|
||||
vars_files:
|
||||
@ -60,6 +61,8 @@
|
||||
required_packages:
|
||||
apt:
|
||||
- "libffi-dev"
|
||||
dnf:
|
||||
- "libffi-devel"
|
||||
yum:
|
||||
- "libffi-devel"
|
||||
zypper:
|
||||
|
@ -29,6 +29,12 @@
|
||||
- libffi-dev
|
||||
- pkg-config
|
||||
- libvirt-dev
|
||||
dnf:
|
||||
- libxml2-devel
|
||||
- libxslt-devel
|
||||
- libffi-devel
|
||||
- pkgconfig
|
||||
- libvirt-devel
|
||||
yum:
|
||||
- libxml2-devel
|
||||
- libxslt-devel
|
||||
|
@ -62,9 +62,11 @@ if [[ -d "/etc/nodepool" ]]; then
|
||||
# output ram usage
|
||||
free -m > "${WORKING_DIR}/logs/memory-available.txt" || true
|
||||
# Redhat package debugging
|
||||
if which yum &>/dev/null; then
|
||||
sudo yum repolist -v > "${WORKING_DIR}/logs/redhat-yum-repolist.txt" || true
|
||||
sudo yum list installed > "${WORKING_DIR}/logs/redhat-yum-list-installed.txt" || true
|
||||
if which yum &>/dev/null || which dnf &>/dev/null; then
|
||||
# Prefer dnf over yum for CentOS.
|
||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||
sudo $RHT_PKG_MGR repolist -v > "${WORKING_DIR}/logs/redhat-rpm-repolist.txt" || true
|
||||
sudo $RHT_PKG_MGR list installed > "${WORKING_DIR}/logs/redhat-rpm-list-installed.txt" || true
|
||||
# SUSE package debugging
|
||||
elif which zypper &>/dev/null; then
|
||||
sudo zypper lr -d > "${WORKING_DIR}/logs/suse-zypper-repolist.txt" || true
|
||||
|
@ -76,7 +76,7 @@
|
||||
with_items: "{{ bridges }}"
|
||||
register: network_interfaces_rhel
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
- name: Copy network configuration (SUSE)
|
||||
template:
|
||||
@ -93,7 +93,7 @@
|
||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt')}}:0"
|
||||
with_items: "{{ bridges }}"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- item.alias is defined
|
||||
|
||||
- name: Put down post-up script for veth-peer interfaces (RedHat)
|
||||
@ -106,7 +106,7 @@
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
# NOTE(hworang): Nested loops do not work on blocks. See
|
||||
# https://github.com/ansible/ansible/issues/13262
|
||||
@ -157,7 +157,7 @@
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
- name: Shut down the network interfaces
|
||||
command: "ifdown {{ item.name | default('br-mgmt') }}"
|
||||
@ -169,7 +169,7 @@
|
||||
- name: Shut down the alias interface (RedHat)
|
||||
command: "ifdown {{ item.name | default('br-mgmt') }}:0"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- network_interfaces_rhel | changed
|
||||
- item.alias is defined
|
||||
with_items: "{{ bridges }}"
|
||||
@ -184,7 +184,7 @@
|
||||
- name: Start the alias interface (RedHat)
|
||||
command: "ifup {{ item.name | default('br-mgmt') }}:0"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- network_interfaces_rhel | changed
|
||||
- item.alias is defined
|
||||
with_items: "{{ bridges }}"
|
||||
|
@ -22,11 +22,11 @@
|
||||
name: lvm2
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- name: Install lvm2 yum package
|
||||
yum:
|
||||
- name: Install lvm2 package
|
||||
package:
|
||||
name: lvm2
|
||||
when:
|
||||
- ansible_pkg_mgr == 'yum'
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- name: Create sparse Cinder file
|
||||
shell: "truncate -s 10G /openstack/cinder.img"
|
||||
args:
|
||||
|
Loading…
x
Reference in New Issue
Block a user