From 12e0c5ae8ef7043cb8d33eac970e27282a4fc4ad Mon Sep 17 00:00:00 2001
From: David Rabel <rabel@b1-systems.de>
Date: Mon, 5 Feb 2018 15:38:17 +0100
Subject: [PATCH] Use apt Ansible module instead of apt-get to update cache

Ansible recommends to use apt module instead of apt-get.
This patch fixes install.yml and pre-install.yml accordingly.

Change-Id: I3241ce332e7cf522786e78280643440a30a23875
Closes-Bug: #1747436
---
 ansible/roles/baremetal/tasks/install.yml     | 3 ++-
 ansible/roles/baremetal/tasks/pre-install.yml | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/baremetal/tasks/install.yml b/ansible/roles/baremetal/tasks/install.yml
index 71ea50efc0..40e94af5d0 100644
--- a/ansible/roles/baremetal/tasks/install.yml
+++ b/ansible/roles/baremetal/tasks/install.yml
@@ -1,6 +1,7 @@
 ---
 - name: Update apt cache
-  command: apt-get update
+  apt:
+    update_cache: yes
   become: True
   when: ansible_os_family == 'Debian'
 
diff --git a/ansible/roles/baremetal/tasks/pre-install.yml b/ansible/roles/baremetal/tasks/pre-install.yml
index 87be47ed2d..a820a11f17 100644
--- a/ansible/roles/baremetal/tasks/pre-install.yml
+++ b/ansible/roles/baremetal/tasks/pre-install.yml
@@ -73,7 +73,8 @@
   when: create_kolla_user | bool
 
 - name: Install apt packages
-  command: apt-get update
+  apt:
+    update_cache: yes
   become: True
   when: ansible_os_family == 'Debian'