From 1b5353593c8f17594b7d39015b6093ef2ae65b14 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Fri, 8 Mar 2019 14:36:08 +0000
Subject: [PATCH] Fix bootstrap-servers on Ansible 2.6+

Recently as part of adding support for Docker CE we added the following
task to the baremetal role:

- name: Update yum cache
  yum:
    update_cache: yes
  become: True
  when: ansible_os_family == 'RedHat'

This works fine on Ansible 2.5, but no longer works on Ansible
2.6, which complains that either the 'name' or 'list' argument
is mandatory for the yum module.

This change updates the cache later on, when installing packages.

Change-Id: I1a158bda52c4e362cb12d361d7f961cfc699b385
Closes-Bug: #1819173
---
 ansible/roles/baremetal/tasks/install.yml | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/ansible/roles/baremetal/tasks/install.yml b/ansible/roles/baremetal/tasks/install.yml
index 8cf7137fa1..90a84f740c 100644
--- a/ansible/roles/baremetal/tasks/install.yml
+++ b/ansible/roles/baremetal/tasks/install.yml
@@ -5,12 +5,6 @@
   become: True
   when: ansible_os_family == 'Debian'
 
-- name: Update yum cache
-  yum:
-    update_cache: yes
-  become: True
-  when: ansible_os_family == 'RedHat'
-
 # TODO(inc0): Gates don't seem to have ufw executable, check for it instead of ignore errors
 - name: Set firewall default policy
   become: True
@@ -62,6 +56,7 @@
   package:
     name: "{{ item }}"
     state: present
+    update_cache: yes
   become: True
   with_items:
     - deltarpm
@@ -71,6 +66,7 @@
   package:
     name: "{{ item }}"
     state: present
+    update_cache: yes
   become: True
   with_items: "{{ redhat_pkg_install }}"
   when: ansible_os_family == 'RedHat'