Dong Ma | fa5d244 | 2024-10-30 10:29:16 +0800 | [diff] [blame] | 1 | # Copyright (c) 2024 VEXXHOST, Inc. |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | - hosts: all |
| 5 | tasks: |
| 6 | - name: Install promtool |
| 7 | block: |
| 8 | - name: Create temporary file to download |
| 9 | ansible.builtin.tempfile: |
| 10 | state: file |
| 11 | suffix: .tar.gz |
| 12 | register: promtool_file |
| 13 | |
| 14 | - name: Download Prometheus |
| 15 | ansible.builtin.get_url: |
| 16 | url: https://github.com/prometheus/prometheus/releases/download/v2.55.0/prometheus-2.55.0.linux-amd64.tar.gz |
| 17 | dest: "{{ promtool_file.path }}" |
| 18 | checksum: sha256:7a6b6d5ea003e8d59def294392c64e28338da627bf760cf268e788d6a8832a23 |
| 19 | |
| 20 | - name: Extract Prometheus into /usr/local/bin |
| 21 | become: true |
| 22 | ansible.builtin.unarchive: |
| 23 | src: "{{ promtool_file.path }}" |
| 24 | dest: /usr/local/bin |
| 25 | remote_src: true |
| 26 | extra_opts: |
| 27 | - --strip-components=1 |
| 28 | include: |
| 29 | - prometheus-2.55.0.linux-amd64/promtool |
| 30 | always: |
| 31 | - name: Remove temporary file |
| 32 | ansible.builtin.file: |
| 33 | path: "{{ promtool_file.path }}" |
| 34 | state: absent |