🔨 Clean temp files

This commit is contained in:
SebClem 2022-01-16 14:01:32 +01:00
parent 64d92cb1df
commit b93a4dc2f8
No known key found for this signature in database
GPG Key ID: 3D8E353F900B1305

View File

@ -57,6 +57,7 @@
dest: "/tmp"
loop: "{{ loki_bins }}"
check_mode: false
when: _download_archive is changed
- name: Copy binaries
copy:
@ -69,6 +70,14 @@
loop: "{{ loki_bins }}"
notify:
- restart loki
when: _download_archive is changed
- name: Clean binaries
file:
path: "/tmp/{{ item }}-linux-{{ go_arch }}"
state: absent
loop: "{{ loki_bins }}"
when: _download_archive is changed
- name: Create systemd service unit
@ -81,3 +90,18 @@
notify: "restart {{ item }}"
loop: "{{ loki_bins }}"
when: item == 'loki' or item == 'promtail'
- name: Find temps files to del
find:
paths: /tmp
file_type: file
patterns: 'loki-*-linux-{{ go_arch }}.zip,promtail-*-linux-{{ go_arch }}.zip'
excludes: 'loki-{{ loki_version }}-linux-{{ go_arch }}.zip,promtail-{{ loki_version }}-linux-{{ go_arch }}.zip'
register: to_del
- name: Clean temp files
file:
path: "{{ item.path }}"
state: absent
loop: "{{ to_del.files }}"