Merge pull request #5 from mondrunov-genlab/add-gitlab-role
fix install (retries, until, delay), add deleting tmp-files and fix permissions for alloy.service
This commit is contained in:
@@ -23,13 +23,16 @@
|
|||||||
block:
|
block:
|
||||||
- name: "Install | Check Alloy version"
|
- name: "Install | Check Alloy version"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "alloy --version"
|
cmd: "alloy --version"
|
||||||
register: grafana_alloy_ver
|
register: grafana_alloy_ver
|
||||||
|
|
||||||
- name: "Install | Assert version correctness"
|
- name: "Install | Assert version correctness"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "grafana_alloy_version in grafana_alloy_ver.stdout"
|
that:
|
||||||
|
- "grafana_alloy_ver.rc == 0"
|
||||||
|
- "grafana_alloy_version in grafana_alloy_ver.stdout"
|
||||||
success_msg: "alloy version {{ grafana_alloy_version }} is installed and working"
|
success_msg: "alloy version {{ grafana_alloy_version }} is installed and working"
|
||||||
fail_msg: "alloy version {{ grafana_alloy_version }} is not installed or not working correctly"
|
fail_msg: "alloy version {{ grafana_alloy_version }} is not installed or not working correctly"
|
||||||
|
|
||||||
@@ -39,10 +42,26 @@
|
|||||||
name: "unzip"
|
name: "unzip"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Install | Fetch and unpack the distribution"
|
- name: "Install | Download the distribution archive"
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "https://github.com/grafana/alloy/releases/download/v{{ grafana_alloy_version }}/alloy-linux-amd64.zip"
|
||||||
|
dest: "/tmp/alloy-linux-amd64.zip"
|
||||||
|
group: "alloy"
|
||||||
|
owner: "alloy"
|
||||||
|
mode: "0644"
|
||||||
|
timeout: 30
|
||||||
|
force: true
|
||||||
|
register: grafana_alloy_download_status
|
||||||
|
until: grafana_alloy_download_status is success
|
||||||
|
retries: 3
|
||||||
|
delay: 5
|
||||||
|
|
||||||
|
- name: "Install | Unpack and delete the distribution"
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "https://github.com/grafana/alloy/releases/download/v{{ grafana_alloy_version }}/alloy-linux-amd64.zip"
|
src: "/tmp/alloy-linux-amd64.zip"
|
||||||
dest: "/tmp"
|
dest: "/tmp"
|
||||||
|
group: "alloy"
|
||||||
|
owner: "alloy"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
- name: "Install | Put the binary under the PATH"
|
- name: "Install | Put the binary under the PATH"
|
||||||
@@ -56,8 +75,11 @@
|
|||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: "Install | Clean up the downloads"
|
- name: "Install | Clean up the downloads"
|
||||||
|
loop:
|
||||||
|
- "/tmp/alloy-linux-amd64"
|
||||||
|
- "/tmp/alloy-linux-amd64.zip"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/tmp/alloy-linux-amd64"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: "Install | Create a systemd service unit"
|
- name: "Install | Create a systemd service unit"
|
||||||
@@ -65,6 +87,6 @@
|
|||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: alloy.service.j2
|
src: alloy.service.j2
|
||||||
dest: /etc/systemd/system/alloy.service
|
dest: /etc/systemd/system/alloy.service
|
||||||
owner: "alloy"
|
owner: "root"
|
||||||
group: "alloy"
|
group: "root"
|
||||||
mode: "0660"
|
mode: "0600"
|
||||||
|
|||||||
Reference in New Issue
Block a user