2017-12-14 19:47:47 +01:00
|
|
|
# Test playbook for the package_facts module
|
|
|
|
# (c) 2017, Adam Miller <admiller@redhat.com>
|
|
|
|
|
|
|
|
# This file is part of Ansible
|
|
|
|
#
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
- name: Prep package_fact tests - Debian Family
|
|
|
|
block:
|
|
|
|
- name: install python apt bindings - python2
|
2019-04-17 03:28:01 +02:00
|
|
|
package: name="python-apt" state=present
|
2017-12-14 19:47:47 +01:00
|
|
|
when: ansible_python.version.major|int == 2
|
|
|
|
|
|
|
|
- name: install python apt bindings - python3
|
2019-04-17 03:28:01 +02:00
|
|
|
package: name="python3-apt" state=present
|
2017-12-14 19:47:47 +01:00
|
|
|
when: ansible_python.version.major|int == 3
|
|
|
|
|
|
|
|
- name: Gather package facts
|
|
|
|
package_facts:
|
|
|
|
manager: apt
|
|
|
|
|
|
|
|
- name: check for ansible_facts.packages exists
|
|
|
|
assert:
|
|
|
|
that: ansible_facts.packages is defined
|
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
- name: Run package_fact tests - Red Hat Family
|
|
|
|
block:
|
|
|
|
- name: Gather package facts
|
|
|
|
package_facts:
|
|
|
|
manager: rpm
|
|
|
|
|
|
|
|
- name: check for ansible_facts.packages exists
|
|
|
|
assert:
|
|
|
|
that: ansible_facts.packages is defined
|
|
|
|
when: (ansible_os_family == "RedHat")
|
|
|
|
|
|
|
|
- name: Run package_fact tests - SUSE/OpenSUSE Family
|
|
|
|
block:
|
|
|
|
- name: install python rpm bindings - python2
|
2019-04-17 03:28:01 +02:00
|
|
|
package: name="rpm-python" state=present
|
2017-12-14 19:47:47 +01:00
|
|
|
when: ansible_python.version.major|int == 2
|
|
|
|
|
|
|
|
- name: install python rpm bindings - python3
|
2019-04-17 03:28:01 +02:00
|
|
|
package: name="python3-rpm" state=present
|
2017-12-14 19:47:47 +01:00
|
|
|
when: ansible_python.version.major|int == 3
|
|
|
|
|
|
|
|
- name: Gather package facts
|
|
|
|
package_facts:
|
|
|
|
manager: rpm
|
|
|
|
|
|
|
|
- name: check for ansible_facts.packages exists
|
|
|
|
assert:
|
|
|
|
that: ansible_facts.packages is defined
|
|
|
|
when: (ansible_os_family == "openSUSE Leap") or (ansible_os_family == "Suse")
|
|
|
|
|
|
|
|
# Check that auto detection works also
|
|
|
|
- name: Gather package facts
|
|
|
|
package_facts:
|
|
|
|
manager: auto
|
|
|
|
|
|
|
|
- name: check for ansible_facts.packages exists
|
|
|
|
assert:
|
|
|
|
that: ansible_facts.packages is defined
|