From 31dc523832353ccfc87a530a3efafbe7f8730617 Mon Sep 17 00:00:00 2001 From: "Nicholas E. Rabenau" Date: Mon, 27 Mar 2017 22:43:28 +0200 Subject: [PATCH] set debian repository based on major version only 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"). use apt_repository instead of file copy --- files/repos/Debian-8.0 | 1 - tasks/os/Debian.yml | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 files/repos/Debian-8.0 diff --git a/files/repos/Debian-8.0 b/files/repos/Debian-8.0 deleted file mode 100644 index 37bccd1..0000000 --- a/files/repos/Debian-8.0 +++ /dev/null @@ -1 +0,0 @@ -deb https://apt.dockerproject.org/repo debian-jessie main diff --git a/tasks/os/Debian.yml b/tasks/os/Debian.yml index c3ea948..8c99ab4 100644 --- a/tasks/os/Debian.yml +++ b/tasks/os/Debian.yml @@ -12,13 +12,16 @@ id: "{{ docker_gpg_key }}" keyserver: "{{ key_server }}" -- name: ensure repo is present - copy: - src: "repos/{{ ansible_distribution }}-{{ ansible_distribution_version }}" - dest: /etc/apt/sources.list.d/docker.list +- name: ensure docker repo is present + apt_repository: + repo: deb https://apt.dockerproject.org/repo debian-jessie main + state: present + filename: docker + update_cache: true - name: ensure docker is installed apt: name: docker-engine state: present - update_cache: yes + update_cache: true + cache_valid_time: 3600