2023-03-03 09:53:02 +01:00
|
|
|
---
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Download Grafana Agent binary to controller (localhost)
|
2023-03-03 09:53:02 +01:00
|
|
|
block:
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Create Grafana Agent temp directory
|
2023-03-03 09:53:02 +01:00
|
|
|
become: false
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ grafana_agent_local_tmp_dir }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0751
|
|
|
|
delegate_to: localhost
|
|
|
|
check_mode: false
|
|
|
|
run_once: true
|
|
|
|
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Download Grafana Agent archive to local folder
|
2023-03-03 09:53:02 +01:00
|
|
|
become: false
|
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: "{{ _grafana_agent_download_url }}"
|
|
|
|
dest: "{{ grafana_agent_local_tmp_dir }}/grafana-agent.zip"
|
|
|
|
mode: 0664
|
|
|
|
register: _download_archive
|
|
|
|
until: _download_archive is succeeded
|
|
|
|
retries: 5
|
|
|
|
delay: 2
|
|
|
|
delegate_to: localhost
|
|
|
|
check_mode: false
|
|
|
|
|
|
|
|
- name: Extract grafana-agent.zip
|
|
|
|
become: false
|
|
|
|
ansible.builtin.unarchive:
|
|
|
|
src: "{{ grafana_agent_local_tmp_dir }}/grafana-agent.zip"
|
|
|
|
dest: "{{ grafana_agent_local_tmp_dir }}"
|
|
|
|
remote_src: false
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
- name: Set local path
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
__grafana_agent_local_binary_file: "{{ grafana_agent_local_tmp_dir }}/{{ grafana_agent_binary }}"
|
|
|
|
|
|
|
|
- name: Propagate downloaded binary
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ grafana_agent_local_tmp_dir }}/{{ _grafana_agent_download_binary_file }}"
|
|
|
|
dest: "{{ grafana_agent_install_dir }}/{{ grafana_agent_binary }}"
|
|
|
|
mode: 0755
|
|
|
|
owner: root
|
|
|
|
group: root
|