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 # install apache on the ec2 instances
- name: install apache on new 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 - name: start and enable apache
service: name=httpd state=started enabled=yes service: name=httpd state=started enabled=yes

View file

@ -9,9 +9,9 @@
# Make sure we start fresh # Make sure we start fresh
- name: remove rpm dependencies for postgresql test - name: remove rpm dependencies for postgresql test
yum: name={{ item }} state=absent package: name={{ item }} state=absent
with_items: postgresql_packages with_items: postgresql_packages
when: ansible_pkg_mgr == 'yum' when: ansible_os_family == "RedHat"
- name: remove dpkg dependencies for postgresql test - name: remove dpkg dependencies for postgresql test
apt: name={{ item }} state=absent apt: name={{ item }} state=absent
@ -35,9 +35,9 @@
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: install rpm dependencies for postgresql test - name: install rpm dependencies for postgresql test
yum: name={{ item }} state=latest package: name={{ item }} state=latest
with_items: postgresql_packages with_items: postgresql_packages
when: ansible_pkg_mgr == 'yum' when: ansible_os_family == "RedHat"
- name: install dpkg dependencies for postgresql test - name: install dpkg dependencies for postgresql test
apt: name={{ item }} state=latest 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> # (c) 2014, James Tanner <tanner.jc@gmail.com>
# This file is part of Ansible # This file is part of Ansible

View file

@ -1,18 +1,17 @@
- name: Install docker packages (yum) - name: Install docker packages (rht family)
yum: package:
state: present state: present
name: docker-io,docker-registry,python-docker-py,nginx name: docker-io,docker-registry,python-docker-py,nginx
- name: Install netcat - name: Install netcat (Fedora)
yum: package:
state: present state: present
name: nmap-ncat name: nmap-ncat
# RHEL7 as well... when: ansible_distribution == 'Fedora' or (ansible_os_family == 'RedHat' and ansible_distribution_version|version_compare('>=', 7))
when: ansible_distribution == 'Fedora'
- name: Install netcat - name: Install netcat (RHEL)
yum: package:
state: present state: present
name: nc 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 yum: name=zip state=latest
when: ansible_pkg_mgr == 'yum' 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) - name: Ensure zip is present to create test archive (apt)
apt: name=zip state=latest apt: name=zip state=latest
when: ansible_pkg_mgr == 'apt' when: ansible_pkg_mgr == 'apt'

View file

@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # 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' - include: 'yum.yml'
when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora'] when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']