Kludge to make Fedora 22 package installs work

Fedora 22 uses dnf, but the ansible release we use sets the
ansible_pkg_mgr fact to yum, which won't work if the relevant
python libraries aren't installed. Reset the fact in playbooks
which install packages to fix package installation for now.
(This change can be safely removed when we start using an ansible
release which prefers dnf.)

Change-Id: If2dd0d45de84a98e627f322a5579b2482e0204c3
This commit is contained in:
stephane 2015-07-29 17:13:47 -07:00
parent c41574f0b4
commit fa4c22030e
2 changed files with 20 additions and 0 deletions

View File

@ -19,6 +19,16 @@
with_first_found:
- "../defaults/required_defaults_{{ ansible_distribution }}.yml"
- "../defaults/required_defaults_{{ ansible_os_family }}.yml"
# NOTE(cinerama): On Fedora 22, ansible 1.9, ansible_pkg_mgr
# defaults to yum, which may not be installed. This can be safely
# removed when we start using an ansible release which prefers dnf.
- name: "Check for dnf"
stat: path=/usr/bin/dnf
register: test_dnf
- name: "Adjust ansible_pkg_mgr if dnf exists"
set_fact:
ansible_pkg_mgr: "dnf"
when: ansible_distribution == 'Fedora' and "{{ test_dnf.stat.exists|bool }}"
- name: "Install required packages"
action: "{{ ansible_pkg_mgr }} name={{item}} state=present"
with_items: required_packages

View File

@ -21,6 +21,16 @@
- name: "Update Package Cache"
apt: update_cache=yes
when: ansible_os_family == 'Debian'
# NOTE(cinerama): On Fedora 22, ansible 1.9, ansible_pkg_mgr
# defaults to yum, which may not be installed. This can be safely
# removed when we start using an ansible release which prefers dnf.
- name: "Check for dnf"
stat: path=/usr/bin/dnf
register: test_dnf
- name: "Adjust ansible_pkg_mgr if dnf exists"
set_fact:
ansible_pkg_mgr: "dnf"
when: ansible_distribution == 'Fedora' and "{{ test_dnf.stat.exists|bool }}"
- name: "Install packages"
action: "{{ ansible_pkg_mgr }} name={{ item }}"
with_items: required_packages