From 52999cd29290702774f1689888a95a02d1326770 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Wed, 24 Jun 2015 12:01:29 -0400 Subject: [PATCH] Check for rpm directly, don't imply from ansible_pkg_manager Atomic host have neither dnf nor yum. So we cannot use that as a hueristic if they have rpm. --- contrib/ansible/roles/common/tasks/main.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/contrib/ansible/roles/common/tasks/main.yml b/contrib/ansible/roles/common/tasks/main.yml index 3404365eb79..f35b503d7ff 100644 --- a/contrib/ansible/roles/common/tasks/main.yml +++ b/contrib/ansible/roles/common/tasks/main.yml @@ -13,9 +13,23 @@ is_atomic: true when: s.stat.exists +- name: Determine if has rpm + stat: path=/usr/bin/rpm + register: s + changed_when: false + +- name: Init the has_rpm fact + set_fact: + has_rpm: false + +- name: Set the has_rpm fact + set_fact: + has_rpm: true + when: s.stat.exists + # collect information about what packages are installed - include: rpm.yml - when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf" + when: has_rpm - include: centos.yml when: ansible_distribution == "CentOS"