mirror of
https://gitea.0xace.cc/ansible-playbooks/victoriametrics.git
synced 2024-11-24 15:46:40 +00:00
first commit
This commit is contained in:
commit
65534b2c47
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.galaxy_install_info
|
||||
roles
|
70
README.md
Normal file
70
README.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Setup VictoriaMetrics 1.101.1 cluster
|
||||
|
||||
## Install ansible and requirements in virtualenv
|
||||
|
||||
mkvirtualenv ansible-9.5.1
|
||||
pip install -r requirements.txt
|
||||
deactivate
|
||||
workon ansible-9.5.1
|
||||
|
||||
## Install roles
|
||||
|
||||
ansible-playbook ansible-roles.yaml
|
||||
|
||||
## Install Patroni
|
||||
|
||||
ansible-playbook -i inventory/hosts victoriametrics.yaml -u almalinux
|
||||
|
||||
|
||||
## Example hosts file:
|
||||
|
||||
[victoriametrics:children]
|
||||
vmstorage
|
||||
vminsert
|
||||
vmselect
|
||||
vmauth
|
||||
vmagent
|
||||
|
||||
[vmstorage]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vminsert]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vmselect]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vmauth]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vmagent]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
Example group_vars:
|
||||
|
||||
victoriametrics_vmauth_reloadAuthKey: reload-auth-key
|
||||
victoriametrics_vmauth_users:
|
||||
- id: "1"
|
||||
username: "foobar"
|
||||
password: "foobar"
|
||||
|
||||
victoriametrics_vmagent_prometheus_config:
|
||||
global:
|
||||
scrape_interval: '1m'
|
||||
scrape_timeout: '1m'
|
||||
scrape_configs:
|
||||
- job_name: 'rgw'
|
||||
stream_parse: true
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:9242']
|
||||
|
6
ansible-roles.yaml
Normal file
6
ansible-roles.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Install roles
|
||||
local_action: ansible.builtin.command ansible-galaxy install -r requirements.yaml -p roles
|
||||
|
13
ansible.cfg
Normal file
13
ansible.cfg
Normal file
@ -0,0 +1,13 @@
|
||||
[defaults]
|
||||
timeout = 300
|
||||
jinja2_native = True
|
||||
host_key_checking = False
|
||||
pipelining = True
|
||||
callbacks_enabled = timer, profile_tasks
|
||||
forks = 50
|
||||
roles_path = roles
|
||||
interpreter_python = auto_silent
|
||||
|
||||
[ssh_connection]
|
||||
pipelining = True
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null
|
4
inventory/group_vars/all.yaml
Normal file
4
inventory/group_vars/all.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
victoriametrics_vmauth_users:
|
||||
- id: "1"
|
||||
username: "foobar"
|
||||
password: "foobar"
|
36
inventory/hosts
Normal file
36
inventory/hosts
Normal file
@ -0,0 +1,36 @@
|
||||
[all]
|
||||
vm-1 ansible_host=192.168.79.84
|
||||
vm-2 ansible_host=192.168.79.69
|
||||
vm-3 ansible_host=192.168.79.80
|
||||
|
||||
[victoriametrics:children]
|
||||
vmstorage
|
||||
vminsert
|
||||
vmselect
|
||||
vmauth
|
||||
vmagent
|
||||
|
||||
[vmstorage]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vminsert]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vmselect]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vmauth]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
||||
|
||||
[vmagent]
|
||||
vm-1
|
||||
vm-2
|
||||
vm-3
|
10
requirements.txt
Normal file
10
requirements.txt
Normal file
@ -0,0 +1,10 @@
|
||||
ansible==9.5.1
|
||||
ansible-core==2.16.6
|
||||
cffi==1.16.0
|
||||
cryptography==42.0.7
|
||||
Jinja2==3.1.4
|
||||
MarkupSafe==2.1.5
|
||||
packaging==24.0
|
||||
pycparser==2.22
|
||||
PyYAML==6.0.1
|
||||
resolvelib==1.0.1
|
7
requirements.yaml
Normal file
7
requirements.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- src: https://gitea.geekhome.org/ansible-galaxy/hosts.git
|
||||
scm: git
|
||||
name: hosts
|
||||
- src: https://gitea.geekhome.org/ansible-galaxy/victoriametrics.git
|
||||
scm: git
|
||||
name: victoriametrics
|
0
vars/victoriametrics.yaml
Normal file
0
vars/victoriametrics.yaml
Normal file
42
victoriametrics.yaml
Normal file
42
victoriametrics.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Print Ansible version
|
||||
debug:
|
||||
msg: "{{ ansible_version }}"
|
||||
|
||||
- hosts: victoriametrics
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Wait 300 seconds
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 300
|
||||
|
||||
- hosts: victoriametrics
|
||||
tasks:
|
||||
- name: Include Patroni vars
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- victoriametrics.yaml
|
||||
paths:
|
||||
- "vars"
|
||||
|
||||
- hosts: victoriametrics
|
||||
gather_facts: true
|
||||
become: true
|
||||
tasks:
|
||||
- name: Set hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ inventory_hostname }}"
|
||||
- import_role:
|
||||
name: hosts
|
||||
- import_role:
|
||||
name: victoriametrics
|
Loading…
Reference in New Issue
Block a user