parent
944c8cde82
commit
bb79d12819
1 changed files with 48 additions and 0 deletions
48
roles/alloy/tasks/main.yaml
Normal file
48
roles/alloy/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
# https://github.com/grafana/grafana-ansible-collection/blob/main/roles/alloy/tasks/deploy.yml#L124
|
||||||
|
- name: ensure alloy user exists
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: alloy
|
||||||
|
system: true
|
||||||
|
append: true
|
||||||
|
create_home: false
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: ensure the `/etc/alloy/` config directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/alloy
|
||||||
|
state: directory
|
||||||
|
mode: "0770"
|
||||||
|
owner: root
|
||||||
|
group: alloy
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: synchronize the additional configuration files directory, if present
|
||||||
|
when: alloy__additional_configs_dir is defined and alloy__additional_configs_dir != ""
|
||||||
|
block:
|
||||||
|
- name: ensure rsync is installed
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: rsync
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: synchronize the additional configuration files directory, if present
|
||||||
|
ansible.posix.synchronize:
|
||||||
|
src: "{{ alloy__additional_configs_dir }}"
|
||||||
|
dest: /etc/alloy/additional
|
||||||
|
delete: true
|
||||||
|
recursive: true
|
||||||
|
use_ssh_args: true
|
||||||
|
rsync_opts:
|
||||||
|
- "--chown=root:alloy"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: delete the additional configuration files directory, if not present
|
||||||
|
when: alloy__additional_configs_dir is not defined or alloy__additional_configs_dir == ""
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/alloy/additional
|
||||||
|
state: absent
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Setup Alloy
|
||||||
|
ansible.builtin.import_role:
|
||||||
|
name: grafana.grafana.alloy
|
||||||
|
become: true
|
||||||
Loading…
Add table
Add a link
Reference in a new issue