From 618ab93b42b5b84a888649145acd5fa9b4038a9e Mon Sep 17 00:00:00 2001 From: Johnny Halfmoon Date: Fri, 16 Nov 2018 11:33:23 +0100 Subject: [PATCH] added rpm caching for to docker repo (#3718) --- inventory/sample/group_vars/all/docker.yml | 4 ++++ roles/container-engine/docker/tasks/main.yml | 1 - roles/container-engine/docker/templates/rh_docker.repo.j2 | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/all/docker.yml b/inventory/sample/group_vars/all/docker.yml index 46859ebd5..c8b042a74 100644 --- a/inventory/sample/group_vars/all/docker.yml +++ b/inventory/sample/group_vars/all/docker.yml @@ -25,6 +25,10 @@ docker_log_opts: "--log-opt max-size=50m --log-opt max-file=5" # define docker bin_dir docker_bin_dir: "/usr/bin" +# keep docker packages after installation; speeds up repeated ansible provisioning runs when '1' +# kubespray deletes the docker package on each run, so caching the package makes sense +docker_rpm_keepcache: 0 + ## An obvious use case is allowing insecure-registry access to self hosted registries. ## Can be ipaddress and domain_name. ## example define 172.19.16.11 or mirror.registry.io diff --git a/roles/container-engine/docker/tasks/main.yml b/roles/container-engine/docker/tasks/main.yml index e9750f692..1b3c629bd 100644 --- a/roles/container-engine/docker/tasks/main.yml +++ b/roles/container-engine/docker/tasks/main.yml @@ -124,7 +124,6 @@ line: 'obsoletes=0' when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic - - name: ensure docker packages are installed action: "{{ docker_package_info.pkg_mgr }}" args: diff --git a/roles/container-engine/docker/templates/rh_docker.repo.j2 b/roles/container-engine/docker/templates/rh_docker.repo.j2 index fe2aeac1c..98936a66a 100644 --- a/roles/container-engine/docker/templates/rh_docker.repo.j2 +++ b/roles/container-engine/docker/templates/rh_docker.repo.j2 @@ -3,6 +3,7 @@ name=Docker-CE Repository baseurl={{ docker_rh_repo_base_url }} enabled=1 gpgcheck=1 +keepcache={{ docker_rpm_keepcache | default('1') }} gpgkey={{ docker_rh_repo_gpgkey }} {% if http_proxy is defined %}proxy={{ http_proxy }}{% endif %} @@ -11,5 +12,6 @@ name=Docker-Engine Repository baseurl={{ dockerproject_rh_repo_base_url }} enabled=1 gpgcheck=1 +keepcache={{ docker_rpm_keepcache | default('1') }} gpgkey={{ dockerproject_rh_repo_gpgkey }} {% if http_proxy is defined %}proxy={{ http_proxy }}{% endif %}