| # Copyright (c) 2024 VEXXHOST, Inc. |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| - hosts: all |
| tasks: |
| - name: Install promtool |
| block: |
| - name: Create temporary file to download |
| ansible.builtin.tempfile: |
| state: file |
| suffix: .tar.gz |
| register: promtool_file |
| |
| - name: Download Prometheus |
| ansible.builtin.get_url: |
| url: https://github.com/prometheus/prometheus/releases/download/v2.55.0/prometheus-2.55.0.linux-amd64.tar.gz |
| dest: "{{ promtool_file.path }}" |
| checksum: sha256:7a6b6d5ea003e8d59def294392c64e28338da627bf760cf268e788d6a8832a23 |
| |
| - name: Extract Prometheus into /usr/local/bin |
| become: true |
| ansible.builtin.unarchive: |
| src: "{{ promtool_file.path }}" |
| dest: /usr/local/bin |
| remote_src: true |
| extra_opts: |
| - --strip-components=1 |
| include: |
| - prometheus-2.55.0.linux-amd64/promtool |
| always: |
| - name: Remove temporary file |
| ansible.builtin.file: |
| path: "{{ promtool_file.path }}" |
| state: absent |