From 42066489eb3968554c17e12106c9dac9043fe9e4 Mon Sep 17 00:00:00 2001 From: Maxime Mouial Date: Fri, 19 Jan 2018 11:37:32 -0500 Subject: [PATCH] Update apt caches every hour to pull the latest package --- README.md | 1 + defaults/main.yml | 1 + tasks/pkg-debian.yml | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 116929fa..752785c1 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Role Variables - `datadog_process_checks` - Array of process checks and options (DEPRECATED: use `process` under `datadog_checks` instead) - `datadog_apt_repo` - Override default Datadog `apt` repository +- `datadog_apt_cache_valid_time` - Override the default apt cache expiration time (default 1 hour) - `datadog_apt_key_url` - Override default url to Datadog `apt` key - `datadog_apt_key_url_new` - Override default url to the new Datadog `apt` key (in the near future the `apt` repo will have to be checked against this new key instead of the current key) - `datadog_agent_allow_downgrade` - Set to `yes` to allow agent downgrades on apt-based platforms (use with caution, see `defaults/main.yml` for details) diff --git a/defaults/main.yml b/defaults/main.yml index 67a9de3a..4b66b3d1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,7 @@ datadog_group: root # default apt repo datadog_apt_repo: "deb http://apt.datadoghq.com/ stable main" +datadog_apt_cache_valid_time: 3600 # default yum repo and keys datadog_yum_repo: "https://yum.datadoghq.com/rpm/{{ ansible_userspace_architecture }}/" diff --git a/tasks/pkg-debian.yml b/tasks/pkg-debian.yml index 9205ddab..efa0dcc6 100644 --- a/tasks/pkg-debian.yml +++ b/tasks/pkg-debian.yml @@ -35,10 +35,14 @@ name: datadog-agent={{ datadog_agent_version }} state: present force: "{{ datadog_agent_allow_downgrade }}" + update_cache: yes + cache_valid_time: "{{ datadog_apt_cache_valid_time }}" when: datadog_agent_version != "" - name: Ensure Datadog agent is installed apt: name: datadog-agent state: latest + update_cache: yes + cache_valid_time: "{{ datadog_apt_cache_valid_time }}" when: datadog_agent_version == ""