Skip to content
This repository was archived by the owner on May 31, 2023. It is now read-only.

Commit 13a6004

Browse files
authored
[fix] Update apt-cache before installing dependencies (#205)
* Update apt-cache before installing dependencies Updates the apt cache before installing Grafana dependencies through the package manager. This resolves a bug where old dependencies, or those with a changed name, would not be installed due to the package manager not being able to find them. Also pins molecule in test-requirements to less than v3 * Move update cache in block with install dependencies
1 parent 209fb88 commit 13a6004

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

tasks/install.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
---
2-
- name: Install dependencies
3-
package:
4-
name: "{{ grafana_dependencies }}"
5-
state: present
6-
register: _install_dep_packages
7-
until: _install_dep_packages is succeeded
8-
retries: 5
9-
delay: 2
2+
3+
- block:
4+
- name: Update apt cache
5+
apt:
6+
update_cache: true
7+
register: _pre_update_apt_cache
8+
until: _pre_update_apt_cache is succeeded
9+
when:
10+
- ansible_pkg_mgr == "apt"
11+
12+
- name: Install dependencies
13+
package:
14+
name: "{{ grafana_dependencies }}"
15+
state: present
16+
register: _install_dep_packages
17+
until: _install_dep_packages is succeeded
18+
retries: 5
19+
delay: 2
1020

1121
- name: Remove conflicting grafana packages
1222
package:

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
molecule>=2.15.0
1+
molecule>=2.15.0,<3.0.0
22
docker
33
ansible-lint>=3.4.0
44
testinfra>=1.7.0

0 commit comments

Comments
 (0)