Files
configpolicy/roles/victoria-metrics/tasks/install.yml
Dustin C. Hatch 0785fda26b r/v-m: Add role for Victoria Metrics
The *victoria-metrics* role deploys a single-server instance of the
Victoria Metrics time series database server.  It installs the selected
version by downloading the binary release from Github and copying it to
`/usr/local/sbin` on the managed node.  Scrape configuration is optional
and can be specified with the `scrape_configs` variable.
2022-08-10 19:47:12 -05:00

62 lines
1.4 KiB
YAML

- name: load installation variables
include_vars: install.yml
- name: load architecture variables
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_architecture }}.yml'
- arch-defaults.yml
- name: ensure victoria metrics release archive is available
delegate_to: localhost
become: false
get_url:
url: '{{ vm_tar_url }}'
checksum: 'sha256:{{ vm_cksm_url }}'
dest: '{{ playbook_dir }}/{{ vm_tar_name }}'
tags:
- download
- name: ensure victoria metrics unpack dir exists locally
delegate_to: localhost
become: false
file:
path: '{{ vm_extract_dir }}'
mode: '0755'
state: directory
tags:
- unarchive
- name: ensure victoria metrics archive is unpacked locally
delegate_to: localhost
become: false
unarchive:
src: '{{ playbook_dir }}/{{ vm_tar_name }}'
dest: '{{ vm_extract_dir }}'
remote_src: true
creates: '{{ vm_extract_dir }}/victoria-metrics-prod'
tags:
- unarchive
- name: ensure victoria metrics is installed
copy:
src: '{{ vm_extract_dir }}/victoria-metrics-prod'
dest: /usr/local/sbin/victoria-metrics
mode: '0755'
diff: false
notify:
- restart victoria-metrics
- name: ensure victoria metrics systemd unit is installed
file:
src: victoria-metrics.service
dest: /etc/systemd/system/victoria-metrics.service
mode: '0644'
notify:
- reload systemd
- restart victoria-metrics
tags:
- service
- systemd