Merge "Add dnf support"

This commit is contained in:
Jenkins 2017-08-07 19:19:42 +00:00 committed by Gerrit Code Review
commit f884e33afd
5 changed files with 30 additions and 35 deletions

View File

@ -55,7 +55,9 @@
tags:
- common-proxy
- name: Drop yum package manager proxy
# NOTE(mhayden): We always deploy the proxy configuration for yum on CentOS
# even if dnf is present.
- name: Deploy yum package manager proxy
lineinfile:
line: 'proxy={{ repo_pkg_cache_url }}'
dest: "/etc/yum.conf"
@ -65,3 +67,17 @@
- repo_pkg_cache_enabled | bool
tags:
- common-proxy
# NOTE(mhayden): If dnf and yum are installed on CentOS, we need to configure
# a proxy for dnf as well.
- name: Deploy dnf package manager proxy
lineinfile:
line: 'proxy={{ repo_pkg_cache_url }}'
dest: "/etc/dnf.conf"
state: "{{ (proxy_check.status == 200) | ternary('present', 'absent') }}"
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == 'dnf'
- repo_pkg_cache_enabled | bool
tags:
- common-proxy

View File

@ -24,35 +24,11 @@
gather_facts: false
user: root
pre_tasks:
- name: Install Python2
- name: Ensure python is installed
register: result
raw: >
source /etc/os-release
case ${ID} in
centos|rhel)
yum list installed python
result=$?
if [ $result -eq 1 ]; then
yum -y install python2
result=2
fi
exit $result;
;;
ubuntu)
dpkg-query -s python &> /dev/null
result=$?
if [ $result -eq 1 ]; then
apt-get -y install python
result=2
fi
exit $result;
;;
esac
raw: apt-get -y install python
when:
- ansible_pkg_mgr == 'apt'
changed_when: "result.rc == 2"
failed_when: "{{ result.rc not in [0, 2] }}"

View File

@ -56,10 +56,13 @@ ssh_key_create
# Determine the distribution which the host is running on
determine_distro
# Prefer dnf over yum for CentOS.
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
# Install the base packages
case ${DISTRO_ID} in
centos|rhel)
yum -y install \
$RHT_PKG_MGR -y install \
git curl autoconf gcc gcc-c++ nc \
python2 python2-devel \
openssl-devel libffi-devel \

View File

@ -88,7 +88,7 @@
retries: 5
delay: 2
when:
- ansible_pkg_mgr == 'yum'
- ansible_pkg_mgr in ['yum', 'dnf']
- name: Remove known problem packages
package:

View File

@ -40,7 +40,7 @@
with_items: "{{ bridges }}"
register: network_interfaces_rhel
when:
- ansible_pkg_mgr == 'yum'
- ansible_pkg_mgr in ['yum', 'dnf']
- name: Create alias file when required (RedHat)
template:
@ -48,7 +48,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)
@ -61,7 +61,7 @@
- "{{ bridges }}"
when:
- item[1].veth_peer is defined
- ansible_pkg_mgr == 'yum'
- ansible_pkg_mgr in ['yum', 'dnf']
- name: Ensure the postup/postdown scripts are loaded (RedHat)
lineinfile:
@ -73,7 +73,7 @@
- "{{ bridges }}"
when:
- item[1].veth_peer is defined
- ansible_pkg_mgr == 'yum'
- ansible_pkg_mgr in ['yum', 'dnf']
- name: Copy multinode network configuration (Debian)
template: