From 2f2ba40696eb39e68c7eaf63525bebb24e890eb6 Mon Sep 17 00:00:00 2001 From: Pablo Escobar Date: Fri, 22 Oct 2021 16:57:21 +0200 Subject: [PATCH] added option so apt cache update can be disabled --- defaults/main.yml | 4 ++++ tasks/main.yml | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 9b839fd..7849c36 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -54,6 +54,10 @@ slurm_group: # EPEL is required to install slurm packages and some dependencies on CentOS/RedHat systems slurm_add_epel_repo: true +# By default we update the apt cache on Debian/Ubuntu but you can disable it +# for faster execution after the initial setup +slurm_update_apt_cache: true + # You can set this to true to enable the openhpc yum repos on centos # If you plan to use packages from openhpc you should also update the list of packages for RedHat below slurm_add_openhpc_repo: false diff --git a/tasks/main.yml b/tasks/main.yml index 27c69ce..ddc0070 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -45,6 +45,14 @@ - not ansible_virtualization_type == "docker" # we cannot modify /etc/hosts in container - not ansible_virtualization_type == "containerd" # we cannot modify /etc/hosts in container +- name: Update apt cache on Debian/Ubuntu systems + ansible.builtin.apt: + update_cache: yes + cache_valid_time: 600 + when: + - ansible_os_family == 'Debian' + - slurm_update_apt_cache + changed_when: false - name: Download slurm config from git if "slurm_config_git_repo" is defined block: @@ -66,13 +74,6 @@ when: slurm_config_git_repo is defined -- name: Make sure the apt cache is updated on Debian/Ubuntu systems - ansible.builtin.apt: - update_cache: yes - cache_valid_time: 600 - when: ansible_os_family == 'Debian' - changed_when: false - - name: Install EPEL repository ansible.builtin.yum: name: epel-release