From 363d392bc19b9dfa8c6c960019ca4491be9ba44d Mon Sep 17 00:00:00 2001 From: David Wahlstrom Date: Fri, 30 Dec 2016 15:27:29 -0800 Subject: [PATCH] Only update apt-cache when needed Instead of always updating the apt cache, leverage the 'update_cache' method during the apt install task. Prior to this patch, every run of this role resulted in a "changed" state. This patch will clean up that report to only be "changed" when this actually did indeed change (as updating the apt-cache isn't a meaningful "change"). --- tasks/os/Debian.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tasks/os/Debian.yml b/tasks/os/Debian.yml index e6a1c75..c3ea948 100644 --- a/tasks/os/Debian.yml +++ b/tasks/os/Debian.yml @@ -16,13 +16,9 @@ copy: src: "repos/{{ ansible_distribution }}-{{ ansible_distribution_version }}" dest: /etc/apt/sources.list.d/docker.list - register: repofile - -- name: ensure apt cache is updated - apt: - update_cache: yes - name: ensure docker is installed apt: name: docker-engine state: present + update_cache: yes