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.
This commit is contained in:
61
roles/victoria-metrics/tasks/install.yml
Normal file
61
roles/victoria-metrics/tasks/install.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user