Fixes for tests that assumed yum as package manager for systems that

have dnf
This commit is contained in:
Toshio Kuratomi 2015-12-20 08:06:26 -08:00
parent 454c8ff5b8
commit 3955ea5a8a
6 changed files with 24 additions and 15 deletions

View file

@ -5,7 +5,12 @@
# install apache on the ec2 instances
- name: install apache on new ec2 instances
yum: name=httpd
package: name=httpd
when: ansible_os_family == 'RedHat'
- name: install apache on new ec2 instances
package: name=apache
when: ansible_os_family == 'Debian'
- name: start and enable apache
service: name=httpd state=started enabled=yes

View file

@ -9,9 +9,9 @@
# Make sure we start fresh
- name: remove rpm dependencies for postgresql test
yum: name={{ item }} state=absent
package: name={{ item }} state=absent
with_items: postgresql_packages
when: ansible_pkg_mgr == 'yum'
when: ansible_os_family == "RedHat"
- name: remove dpkg dependencies for postgresql test
apt: name={{ item }} state=absent
@ -35,9 +35,9 @@
when: ansible_os_family == "Debian"
- name: install rpm dependencies for postgresql test
yum: name={{ item }} state=latest
package: name={{ item }} state=latest
with_items: postgresql_packages
when: ansible_pkg_mgr == 'yum'
when: ansible_os_family == "RedHat"
- name: install dpkg dependencies for postgresql test
apt: name={{ item }} state=latest

View file

@ -1,4 +1,3 @@
# test code for the yum module
# (c) 2014, James Tanner <tanner.jc@gmail.com>
# This file is part of Ansible

View file

@ -1,18 +1,17 @@
- name: Install docker packages (yum)
yum:
- name: Install docker packages (rht family)
package:
state: present
name: docker-io,docker-registry,python-docker-py,nginx
- name: Install netcat
yum:
- name: Install netcat (Fedora)
package:
state: present
name: nmap-ncat
# RHEL7 as well...
when: ansible_distribution == 'Fedora'
when: ansible_distribution == 'Fedora' or (ansible_os_family == 'RedHat' and ansible_distribution_version|version_compare('>=', 7))
- name: Install netcat
yum:
- name: Install netcat (RHEL)
package:
state: present
name: nc
when: ansible_distribution != 'Fedora'
when: ansible_distribution != 'Fedora' and (ansible_os_family == 'RedHat' and ansible_distribution_version|version_compare('<', 7))

View file

@ -21,6 +21,10 @@
yum: name=zip state=latest
when: ansible_pkg_mgr == 'yum'
- name: Ensure zip is present to create test archive (dnf)
dnf: name=zip state=latest
when: ansible_pkg_mgr == 'dnf'
- name: Ensure zip is present to create test archive (apt)
apt: name=zip state=latest
when: ansible_pkg_mgr == 'apt'

View file

@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Note: We install the yum package onto Fedora so that this will work on dnf systems
# We want to test that for people who don't want to upgrade their systems.
- include: 'yum.yml'
when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']