### Initialize Development Environment Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Initializes a Python virtual environment and installs necessary packages for linting and testing with Molecule. Requires Docker, Python, and Make to be installed. ```sh make init-venv ``` -------------------------------- ### Run Ansible Playbook Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Command to execute an Ansible playbook. This example runs the 'deploy_vmsingle.yml' playbook using the specified inventory file. Address any errors during execution. ```sh ansible-playbook -i inventory.ini deploy_vmsingle.yml ``` -------------------------------- ### Example Inventory for VictoriaTraces Cluster Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/docs/victoriatraces-cluster.md An example inventory file demonstrating how to define hosts and groups for a VictoriaTraces cluster deployment. This file is crucial for Ansible to target the correct machines. ```ini [vms] ``` -------------------------------- ### Setup VictoriaMetrics Cluster Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Ansible playbook to set up a VictoriaMetrics cluster with vmstorage, vmselect, and vminsert nodes. Requires a corresponding inventory file. ```yaml --- - name: Setup vmstorage nodes become: true hosts: vmstorage collections: - victoriametrics.cluster roles: - role: vmstorage vars: vmstorage_version: "v1.140.0" vmstorage_retention_period: 12 vmstorage_data_dir: "/var/lib/vmstorage" vmstorage_config: retentionPeriod: "12" storageDataPath: "/var/lib/vmstorage" - name: Setup vmselect nodes become: true hosts: vmselect collections: - victoriametrics.cluster vars: vmselect_cache_dir: "/var/lib/vmselect" vmselect_config: cacheDataPath: "/var/lib/vmselect" storageNode: "{{ groups['vmstorage'] | join(',') }}" roles: - vmselect - name: Setup vminsert nodes become: true hosts: vminsert collections: - victoriametrics.cluster vars: vminsert_config: replicationFactor: 1 storageNode: "{{ groups['vmstorage'] | join(',') }}" roles: - vminsert - name: Setup vmauth load balancer become: true hosts: vmauth collections: - victoriametrics.cluster vars: vmauth_auth_config: | unauthorized_user: url_map: - src_paths: - "/insert/.+" url_prefix: {% for insert in groups['vminsert'] %} - "http://{{ insert }}:8480/" {% endfor %} - src_paths: - "/select/.+" url_prefix: {% for select in groups['vmselect'] %} - "http://{{ select }}:8481/" {% endfor %} roles: - vmauth ``` -------------------------------- ### Define Inventory for Ansible Playbook Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md An example inventory file for Ansible. It defines a group 'homelab' and lists the IP addresses of the hosts to be managed. Adjust IP addresses to match your environment. ```ini [homelab] 192.168.50.2 ``` -------------------------------- ### Install Victoria Metrics Collection Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Installs the Victoria Metrics Ansible collection from Ansible Galaxy. This is a prerequisite for using the provided roles and playbooks. ```sh ansible-galaxy collection install victoriametrics.cluster ``` -------------------------------- ### Deploy VictoriaMetrics Single Node Playbook Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md A sample Ansible playbook to deploy a single node VictoriaMetrics instance. It uses the 'vmsingle' role and allows configuration of variables like retention period. Ensure the 'victoriametrics.cluster' collection is installed. ```yaml - name: Deploy VictoriaMetrics hosts: homelab become: true collections: - victoriametrics.cluster roles: - role: vmsingle vars: # Check available variables and their defaults here: # https://github.com/VictoriaMetrics/ansible-playbooks/tree/master/roles/vmsingle victoriametrics_retention_period_months: "3" ``` -------------------------------- ### Configure vmselect with Environment Variables Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmselect/README.md Use `vmselect_config` to set environment variables for vmselect. Dots in flag names are replaced with underscores. This example sets `search_maxUniqueTimeseries` corresponding to the `-search.maxUniqueTimeseries` flag. ```yaml vmselect_config: storageNode: "vmstorage1,vmstorage2,vmstorage3" search_maxUniqueTimeseries: 900000 # corresponds to -search.maxUniqueTimeseries flag ``` -------------------------------- ### VictoriaTraces Cluster Deployment Playbook Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/docs/victoriatraces-cluster.md This is the main playbook for deploying a VictoriaTraces cluster and vmauth. It orchestrates the setup of storage, insertion, and selection nodes, along with the load balancer. ```yaml --- ``` -------------------------------- ### VictoriaMetrics Cluster Inventory Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Example Ansible inventory file for a VictoriaMetrics cluster, defining groups for vmstorage, vminsert, vmselect, and vmauth nodes. ```ini # inventory: cluster-inventory [vmstorage] vmstorage-01 vmstorage-02 vmstorage-03 [vminsert] vminsert-01 vminsert-02 vminsert-03 [vmselect] vmselect-01 vmselect-02 [victoria_cluster:children] vmselect vminsert vmstorage [vmauth] vmauth-01 vmauth-02 ``` -------------------------------- ### Configure vmagent Service Arguments Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmagent/README.md Pass arguments directly as command-line flags to the vmagent service. Ensure correct paths and URLs are specified. ```yaml vmagent_service_args: promscrape.config: "/opt/vic-vmagent/scrape.yml" remoteWrite.url: "http://localhost:8428/api/v1/write" remoteWrite.tmpDataPath: "/var/lib/vmagent-remotewrite-data" ``` -------------------------------- ### Configure vmstorage with Environment Variables Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmstorage/README.md Use `vmstorage_config` to set retention period, data path, and minimum free disk space. Environment variables map to flags by replacing '.' with '_'. ```yaml vmstorage_config: retentionPeriod: 1 storageDataPath: "/var/lib/vmstorage" storage_minFreeDiskSpaceBytes: "1GB" # corresponds to -storage.minFreeDiskSpaceBytes flag ``` -------------------------------- ### Configure vmagent Service Arguments Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vlagent/README.md Keys in `vlagent_service_args` are directly passed as command-line flags to the vmagent service. Ensure correct formatting for flags like `remoteWrite.url` and `remoteWrite.tmpDataPath`. ```yaml vlagent_service_args: remoteWrite.url: "http://localhost:9428/insert/jsonline" remoteWrite.tmpDataPath: "/var/lib/vlagent-remotewrite-data" ``` -------------------------------- ### Configure vmalert Service Arguments Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmalert/README.md Pass command-line flags directly to the vmalert service. Ensure the datasource and notifier URLs are correctly set. ```yaml vic_vm_alert_service_args: datasource.url: "http://localhost:8428" notifier.url: "http://localhost:9093" rule: "/opt/vic-vmalert/rules.yml" ``` -------------------------------- ### Deploy VictoriaMetrics with Proxy Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Configures HTTP/HTTPS proxy settings for downloading binaries in air-gapped environments. Optionally download binaries to the control node first. ```yaml # playbook: deploy_with_proxy.yml - name: Deploy with Proxy hosts: all become: true collections: - victoriametrics.cluster roles: - role: vmsingle vars: victoriametrics_version: "v1.140.0" # Proxy settings for binary downloads vm_proxy_http: "http://proxy.company.com:8080" vm_proxy_https: "http://proxy.company.com:8080" # Download to control node first, then distribute victoriametrics_install_download_to_control: true ``` -------------------------------- ### Configure vmauth via Environment Variables and Service Arguments Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmauth/README.md Use `vmauth_config` for environment variable-based configuration, replacing dots with underscores. Use `vmauth_service_args` for direct command-line flags where dots are preserved. ```yaml vmauth_config: # envflag-based config: use _ instead of . http_pathPrefix: "/vm" # corresponds to -http.pathPrefix vmauth_service_args: # CLI flags: dots work as-is http.pathPrefix: "/vm" # passed directly as --http.pathPrefix ``` -------------------------------- ### Run Molecule Scenario for VictoriaLogs Cluster Integration Test Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/docs/victorialogs-cluster.md Execute the molecule scenario to set up a local VictoriaLogs cluster for integration testing. This command uses Docker as the driver. ```bash make molecule-converge-vlcluster-integration ``` -------------------------------- ### Enable and Set victoriatraces_service_envflag_data Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vtsingle/README.md Enable passing arguments as environment variables by setting `victoriatraces_service_envflag_enabled` to true. Replace dots in flag names with underscores for environment variable keys. ```yaml victoriatraces_service_envflag_enabled: "true" victoriatraces_service_envflag_data: - "http_pathPrefix=/traces" ``` -------------------------------- ### Run Molecule Converge (Integration Scenario) Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Executes the Molecule converge command for the integration scenario across all Ansible roles. This is useful for testing more complex interactions. ```sh make molecule-converge-integration ``` -------------------------------- ### Deploy vmauth as Load Balancer Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Deploys vmauth as an authentication proxy and load balancer. Configure version and authentication/routing rules using a YAML string. ```yaml - name: Deploy vmauth as Load Balancer hosts: load_balancers become: true collections: - victoriametrics.cluster roles: - role: vmauth vars: vmauth_version: "v1.140.0" # Authentication and routing configuration vmauth_auth_config: | users: - username: "admin" password: "secretpassword" url_prefix: "http://vmselect:8481/select/0/prometheus/" - username: "writer" password: "writepassword" url_prefix: "http://vminsert:8480/insert/0/prometheus/" # Public read access (no auth required) unauthorized_user: url_map: - src_paths: - "/select/.+" url_prefix: - "http://vmselect-1:8481/" - "http://vmselect-2:8481/" - src_paths: - "/insert/.+" url_prefix: - "http://vminsert-1:8480/" - "http://vminsert-2:8480/" # Optional: Additional configuration via environment variables vmauth_config: http_pathPrefix: "/vm" ``` -------------------------------- ### Run Molecule Converge (Default Scenario) Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Runs the Molecule converge command for the default scenario across all Ansible roles. This is used for testing role functionality. ```sh make molecule-converge ``` -------------------------------- ### Deploy vmalert with custom configuration Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Deploys vmalert using the victoriametrics.cluster collection. Configure version, datasource URL, Alertmanager URL, evaluation interval, service arguments, and alerting rules. ```yaml - name: Deploy vmalert hosts: alert_servers become: true collections: - victoriametrics.cluster roles: - role: vmalert vars: vic_vm_alert_version: "v1.140.0" vic_vm_alert_datasource_url: "http://victoriametrics:8428" vic_vm_alert_alertmanager_url: "http://alertmanager:9093" vic_vm_alert_evaluation_interval: "30s" # Service arguments vic_vm_alert_service_args: "httpListenAddr": "0.0.0.0:9431" "datasource.url": "http://victoriametrics:8428" "notifier.url": "http://alertmanager:9093" "evaluationInterval": "30s" # Alerting rules vic_vm_alert_rules: - name: infrastructure_alerts rules: - alert: HostOutOfMemory expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100 < 10 for: 2m labels: severity: warning annotations: summary: "Host out of memory (instance {{ $labels.instance }})" description: "Node memory is filling up (< 10% left)\n VALUE = {{ $value }}" - alert: HostHighCpuLoad expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 80 for: 5m labels: severity: warning annotations: summary: "Host high CPU load (instance {{ $labels.instance }})" description: "CPU load is > 80%\n VALUE = {{ $value }}" - alert: VictoriaMetricsDown expr: up{job="victoriametrics"} == 0 for: 1m labels: severity: critical annotations: summary: "VictoriaMetrics is down" description: "VictoriaMetrics instance {{ $labels.instance }} is unreachable" ``` -------------------------------- ### Deploy vmsingle Role Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Use this role to deploy a single-node VictoriaMetrics instance for metrics storage. Configure version, data directory, retention, and service arguments. Optional S3 backup configuration is also supported. ```yaml # playbook: deploy_vmsingle.yml - name: Deploy VictoriaMetrics Single Node hosts: metrics_servers become: true collections: - victoriametrics.cluster roles: - role: vmsingle vars: # Version control victoriametrics_version: "v1.140.0" victoriametrics_enterprise: false # Data and retention settings victoriametrics_data_dir: "/var/lib/victoria-metrics/" victoriametrics_retention_period_months: "12" victoriametrics_search_max_unique_timeseries: "900000" # Service arguments (passed as command-line flags) victoriametrics_service_args: storageDataPath: "/var/lib/victoria-metrics/" selfScrapeInterval: "30s" retentionPeriod: "12" maxConcurrentInserts: 32 "search.maxUniqueTimeseries": "900000" # Optional: S3 backup configuration victoriametrics_backup_enabled: true victoriametrics_backup_destination: "s3://my-bucket/vm-backups" victoriametrics_backup_access_key: "AKIAIOSFODNN7EXAMPLE" victoriametrics_backup_secret_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" victoriametrics_backup_region: "us-west-2" victoriametrics_backup_cron_hour: "*/2" victoriametrics_backup_cron_minute: "0" ``` -------------------------------- ### Set victoriatraces_service_args Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vtsingle/README.md Pass arguments directly as command-line flags to the victoriatraces service. Use dot notation for nested flags. ```yaml victoriatraces_service_args: storageDataPath: "/var/lib/victoria-traces/" "http.pathPrefix": "/traces" ``` -------------------------------- ### Set victorialogs_service_args for command-line flags Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vlsingle/README.md Use `victorialogs_service_args` to pass configuration options directly as command-line flags to the victorialogs service. Keys are converted to flags, and dots in keys are preserved. ```yaml victorialogs_service_args: storageDataPath: "/var/lib/victoria-logs/" "retention.maxDiskSpaceUsageBytes": "10GB" # passed as -retention.maxDiskSpaceUsageBytes ``` -------------------------------- ### Molecule Command for VictoriaTraces Integration Test Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/docs/victoriatraces-cluster.md This command is used to run the molecule scenario for the VictoriaTraces cluster integration test. It typically involves setting up Docker containers for each component. ```bash make molecule-converge-vtcluster-integration ``` -------------------------------- ### Configure vminsert Configuration Parameters Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vminsert/README.md Use this snippet to set vminsert configuration parameters such as replication factor, storage nodes, and queue duration. The `insert_maxQueueDuration` parameter corresponds to the `-insert.maxQueueDuration` flag. ```yaml vminsert_config: replicationFactor: 1 storageNode: "vmstorage1,vmstorage2,vmstorage3" insert_maxQueueDuration: "1m" # corresponds to -insert.maxQueueDuration flag ``` -------------------------------- ### Pass Arguments as Command-Line Flags Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmsingle/README.md Use `victoriametrics_service_args` to pass arguments directly as command-line flags to VictoriaMetrics services. Keys are directly translated into flags. ```yaml victoriametrics_service_args: storageDataPath: "/var/lib/victoria-metrics/" retentionPeriod: "12" "search.maxUniqueTimeseries": "900000" # passed as -search.maxUniqueTimeseries ``` -------------------------------- ### Enable and set victorialogs_service_envflag_data for environment variables Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vlsingle/README.md When `victorialogs_service_envflag_enabled` is true, `victorialogs_service_envflag_data` entries are passed as environment variables. Dots in flag names are replaced with underscores for environment variable usage. ```yaml victorialogs_service_envflag_enabled: "true" victorialogs_service_envflag_data: - "retention_maxDiskSpaceUsageBytes=10GB" # corresponds to -retention.maxDiskSpaceUsageBytes flag ``` -------------------------------- ### Pass Arguments as Environment Variables Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmsingle/README.md When `victoriametrics_service_envflag_enabled` is true, use `victoriametrics_service_envflag_data` to pass arguments as environment variables. Dots in flag names must be replaced with underscores. ```yaml victoriametrics_service_envflag_enabled: "true" victoriametrics_service_envflag_data: - "search_maxUniqueTimeseries=900000" # corresponds to -search.maxUniqueTimeseries flag ``` -------------------------------- ### Run Ansible Lint Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Executes ansible-lint on all roles and playbooks within the project to check for potential issues and enforce coding standards. ```sh make lint ``` -------------------------------- ### Deploy VictoriaTraces Single Node Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Ansible playbook to deploy a single-node VictoriaTraces instance for distributed tracing storage and querying. ```yaml # playbook: deploy_vtsingle.yml - name: Deploy VictoriaTraces Single Node hosts: tracing_servers become: true collections: - victoriametrics.cluster roles: - role: vtsingle vars: victoritraces_version: "v1.50.0" victoritraces_data_dir: "/var/lib/victoria-traces/" victoritraces_retention_period_days: "7" # Service arguments victoritraces_service_args: storageDataPath: "/var/lib/victoria-traces/" retentionPeriod: "7" "retention.maxDiskSpaceUsageBytes": "100GB" ``` -------------------------------- ### VictoriaMetrics Cluster Deployment Diagram Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/docs/victoriametrics-cluster.md Diagram illustrating the architecture of a VictoriaMetrics cluster deployment, showing the flow of write and read traffic through vmauth, vminsert, vmstorage, and vmselect components. ```mermaid graph TD Write[Write traffic] --> vmauth-write[vmauth] vmauth-write -- /insert/* --> vminsert-1 vmauth-write -- /insert/* --> vminsert-N subgraph vminsert group vminsert-1 vminsert-N end vminsert-1 --> vmstorage-1 vminsert-1 --> vmstorage-N vminsert-N --> vmstorage-1 vminsert-N --> vmstorage-N subgraph vmstorage group vmstorage-1 vmstorage-N end vmstorage-1 --> vmselect-1 vmstorage-1 --> vmselect-N vmstorage-N --> vmselect-1 vmstorage-N --> vmselect-N subgraph vmselect group vmselect-1 vmselect-N end vmselect-1 -- /select/* --> vmauth-read[vmauth] vmselect-N -- /select/* --> vmauth-read vmauth-read --> Grafana vmauth-read --> vmalert subgraph Read traffic Grafana vmalert end ``` -------------------------------- ### Deploy VictoriaMetrics Enterprise Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Deploys the enterprise version of VictoriaMetrics. Configure version and license key (inline or from file). Enterprise-specific arguments like downsampling periods can be set. ```yaml # playbook: deploy_enterprise.yml - name: Deploy VictoriaMetrics Enterprise hosts: metrics_servers become: true collections: - victoriametrics.cluster roles: - role: vmsingle vars: victoriametrics_version: "v1.140.0" victoriametrics_enterprise: true # Option 1: Inline license key victoriametrics_license_key: "your-enterprise-license-key-here" # Option 2: License key from file # victoriametrics_license_key_file: "/etc/victoriametrics/license.key" victoriametrics_service_args: storageDataPath: "/var/lib/victoria-metrics/" retentionPeriod: "24" # Enterprise features "downsampling.period": "30d:5m,90d:1h" ``` -------------------------------- ### Deploy VictoriaTraces Single Node Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Deploys a single node for VictoriaTraces. Configure version, data directory, and retention period. Service arguments can be customized for storage path, retention, and HTTP path prefix. ```yaml # playbook: deploy_vtsingle.yml - name: Deploy VictoriaTraces Single Node hosts: trace_servers become: true collections: - victoriametrics.cluster roles: - role: vtsingle vars: victoriatraces_version: "v0.3.0" victoriatraces_data_dir: "/var/lib/victoria-traces/" victoriatraces_retention_period_months: "12" # Service arguments victoriatraces_service_args: storageDataPath: "/var/lib/victoria-traces/" retentionPeriod: "12" "http.pathPrefix": "/traces" # Optional: Environment variable configuration victoriatraces_service_envflag_enabled: "true" victoriatraces_service_envflag_data: - "http_pathPrefix=/traces" ``` -------------------------------- ### Deploy VictoriaLogs Single Node Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Ansible playbook to deploy a single-node VictoriaLogs instance. Configurable with version, data directory, and retention period. ```yaml # playbook: deploy_vlsingle.yml - name: Deploy VictoriaLogs Single Node hosts: log_servers become: true collections: - victoriametrics.cluster roles: - role: vlsingle vars: victorialogs_version: "v1.50.0" victorialogs_data_dir: "/var/lib/victoria-logs/" victorialogs_retention_period_months: "12" # Service arguments victorialogs_service_args: storageDataPath: "/var/lib/victoria-logs/" retentionPeriod: "12" "retention.maxDiskSpaceUsageBytes": "100GB" ``` -------------------------------- ### VictoriaLogs Cluster Deployment Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Ansible playbook for deploying a VictoriaLogs cluster using the vlsingle role for storage, insert, and select components. ```yaml # playbook: vlcluster.yml --- - name: Setup vlstorage nodes become: true hosts: vlstorage collections: - victoriametrics.cluster roles: - vlsingle # Uses default config as storage node - name: Setup vlinsert nodes become: true hosts: vlinsert collections: - victoriametrics.cluster vars: victorialogs_service_args: storageNode: "{{ groups['vlstorage'] | map('regex_replace', '$', ':9428') | join(',') }}" "select.disable": "true" roles: - vlsingle - name: Setup vlselect nodes become: true hosts: vlselect collections: - victoriametrics.cluster vars: victorialogs_service_args: storageNode: "{{ groups['vlstorage'] | map('regex_replace', '$', ':9428') | join(',') }}" "insert.disable": "true" roles: - vlsingle - name: Setup vmauth for VictoriaLogs become: true hosts: vmauth collections: - victoriametrics.cluster vars: vmauth_auth_config: | unauthorized_user: url_map: - src_paths: - "/insert/.+" url_prefix: {% for insert in groups['vlinsert'] %} - "http://{{ insert }}:9428/" {% endfor %} - src_paths: - "/select/.+" url_prefix: {% for select in groups['vlselect'] %} - "http://{{ select }}:9428/" {% endfor %} roles: - vmauth ``` -------------------------------- ### Deploy vmagent Role Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Use this role to deploy vmagent for scraping Prometheus targets and remote writing. Configure version, remote write endpoint, service arguments, and Prometheus scrape configurations. Optional stream aggregation is also supported. ```yaml # playbook: deploy_vmagent.yml - name: Deploy vmagent hosts: scrape_servers become: true collections: - victoriametrics.cluster roles: - role: vmagent vars: vmagent_version: "v1.140.0" vmagent_remote_write_host: "http://victoriametrics:8428" # Service arguments vmagent_service_args: "remoteWrite.url": "http://victoriametrics:8428/api/v1/write" "promscrape.config": "/opt/vic-vmagent/config.yml" "remoteWrite.tmpDataPath": "/tmp/vmagent" "remoteWrite.streamAggr.config": "/opt/vic-vmagent/aggregation.yml" # Prometheus scrape configuration vmagent_scrape_config: scrape_configs: - job_name: node_exporter static_configs: - targets: - "server1:9100" - "server2:9100" - "server3:9100" - job_name: kubernetes_pods kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] action: keep regex: true # Optional: Stream aggregation vmagent_aggregation_config: - match: '{__name__=~"http_requests_total"}' interval: 1m outputs: ["total", "increase"] ``` -------------------------------- ### Deploy vlagent for Log Collection Source: https://context7.com/victoriametrics/ansible-playbooks/llms.txt Ansible playbook to deploy vlagent for collecting and forwarding logs to VictoriaLogs. Configurable with version and remote write host. ```yaml # playbook: deploy_vlagent.yml - name: Deploy vlagent hosts: app_servers become: true collections: - victoriametrics.cluster roles: - role: vlagent vars: vlagent_version: "v1.50.0" vlagent_remote_write_host: "http://victorialogs:9428" # Service arguments vlagent_service_args: "remoteWrite.url": "http://victorialogs:9428/internal/insert" ``` -------------------------------- ### Manage External Alert Rules for vmalert Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/roles/vmalert/README.md Disable default rules and specify external rule files for vmalert. This allows for managing rules outside the Ansible role, using wildcards for multiple files. ```yaml vic_vm_alert_default_rules_enabled: false vic_vm_alert_service_args: rule: "/opt/vic-vmalert/rules/*.yml" rule.configCheckInterval: "30s" ``` -------------------------------- ### Destroy Molecule Instances Source: https://github.com/victoriametrics/ansible-playbooks/blob/master/README.md Destroys all instances created by Molecule during testing. This command cleans up the testing environment. ```sh make molecule-destroy ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.