Skip to content

Commit

Permalink
Refresh apt cache before installing packages (#179)
Browse files Browse the repository at this point in the history
Run an apt refresh at the start of each role. We can use grace time so
we don't neet to refresh it every time and safe some time.

fixes #167
  • Loading branch information
widhalmt authored Oct 17, 2023
1 parent 976d739 commit d429b15
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions roles/beats/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
- '{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_os_family }}.yml'

- name: Update apt cache.
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 600
changed_when: false
when: ansible_os_family == 'Debian'

- name: Prepare for whole stack roles if used
when:
- elasticstack_full_stack | bool
Expand Down
8 changes: 8 additions & 0 deletions roles/elasticsearch/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
---

- name: Update apt cache.
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 600
changed_when: false
when: ansible_os_family == 'Debian'

- name: Check-set-parameters
ansible.builtin.include_tasks: elasticsearch-parameters.yml

Expand Down
7 changes: 7 additions & 0 deletions roles/kibana/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---

- name: Update apt cache.
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 600
changed_when: false
when: ansible_os_family == 'Debian'

- name: Include OS specific vars
ansible.builtin.include_vars: '{{ item }}'
with_first_found:
Expand Down
7 changes: 7 additions & 0 deletions roles/logstash/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---

- name: Update apt cache.
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 600
changed_when: false
when: ansible_os_family == 'Debian'

- name: Include OS specific vars
ansible.builtin.include_vars: '{{ item }}'
with_first_found:
Expand Down

0 comments on commit d429b15

Please sign in to comment.