mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-22 17:03:07 +01:00
use global vars in states
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls in allowed_states %}
|
||||
{% from 'vars/globals.map.jinja' import GLOBALS %}
|
||||
|
||||
{% set GRAFANA = salt['pillar.get']('manager:grafana', '0') %}
|
||||
|
||||
{% if grains['role'] in ['so-manager', 'so-managersearch', 'so-standalone'] or (grains.role == 'so-eval' and GRAFANA == 1) %}
|
||||
|
||||
{% set MANAGER = salt['grains.get']('master') %}
|
||||
{% set VERSION = salt['pillar.get']('global:soversion') %}
|
||||
{% set IMAGEREPO = salt['pillar.get']('global:imagerepo') %}
|
||||
{% import_yaml 'influxdb/defaults.yaml' as default_settings %}
|
||||
{% set influxdb = salt['grains.filter_by'](default_settings, default='influxdb', merge=salt['pillar.get']('influxdb', {})) %}
|
||||
{% from 'salt/map.jinja' import PYTHON3INFLUX with context %}
|
||||
@@ -48,7 +45,7 @@ influxdbconf:
|
||||
|
||||
so-influxdb:
|
||||
docker_container.running:
|
||||
- image: {{ MANAGER }}:5000/{{ IMAGEREPO }}/so-influxdb:{{ VERSION }}
|
||||
- image: {{ GLOBALS.registry_host }}:5000/{{ GLOBALS.image_repo }}/so-influxdb:{{ GLOBALS.so_version }}
|
||||
- hostname: influxdb
|
||||
- environment:
|
||||
- INFLUXDB_HTTP_LOG_ENABLED=false
|
||||
@@ -72,11 +69,22 @@ append_so-influxdb_so-status.conf:
|
||||
- name: /opt/so/conf/so-status/so-status.conf
|
||||
- text: so-influxdb
|
||||
|
||||
# Install cron job to determine size of influxdb for telegraf
|
||||
get_influxdb_size:
|
||||
cron.present:
|
||||
- name: 'du -s -k /nsm/influxdb | cut -f1 > /opt/so/log/telegraf/influxdb_size.log 2>&1'
|
||||
- user: root
|
||||
- minute: '*/1'
|
||||
- hour: '*'
|
||||
- daymonth: '*'
|
||||
- month: '*'
|
||||
- dayweek: '*'
|
||||
|
||||
# We have to make sure the influxdb module is the right version prior to state run since reload_modules is bugged
|
||||
{% if PYTHONINFLUXVERSIONINSTALLED == PYTHONINFLUXVERSION %}
|
||||
wait_for_influxdb:
|
||||
http.query:
|
||||
- name: 'https://{{MANAGER}}:8086/query?q=SHOW+DATABASES'
|
||||
- name: 'https://{{GLOBALS.manager}}:8086/query?q=SHOW+DATABASES'
|
||||
- ssl: True
|
||||
- verify_ssl: False
|
||||
- status: 200
|
||||
@@ -94,7 +102,7 @@ telegraf_database:
|
||||
- ssl: True
|
||||
- verify_ssl: /etc/pki/ca.crt
|
||||
- cert: ['/etc/pki/influxdb.crt', '/etc/pki/influxdb.key']
|
||||
- influxdb_host: {{ MANAGER }}
|
||||
- influxdb_host: {{ GLOBALS.manager }}
|
||||
- require:
|
||||
- docker_container: so-influxdb
|
||||
- sls: salt.python3-influxdb
|
||||
@@ -112,7 +120,7 @@ telegraf_database:
|
||||
- ssl: True
|
||||
- verify_ssl: /etc/pki/ca.crt
|
||||
- cert: ['/etc/pki/influxdb.crt', '/etc/pki/influxdb.key']
|
||||
- influxdb_host: {{ MANAGER }}
|
||||
- influxdb_host: {{ GLOBALS.manager }}
|
||||
- require:
|
||||
- docker_container: so-influxdb
|
||||
- influxdb_database: telegraf_database
|
||||
@@ -130,7 +138,7 @@ so_downsample_{{measurement}}_cq:
|
||||
- ssl: True
|
||||
- verify_ssl: /etc/pki/ca.crt
|
||||
- cert: ['/etc/pki/influxdb.crt', '/etc/pki/influxdb.key']
|
||||
- influxdb_host: {{ MANAGER }}
|
||||
- influxdb_host: {{ GLOBALS.manager }}
|
||||
- require:
|
||||
- docker_container: so-influxdb
|
||||
- influxdb_database: telegraf_database
|
||||
|
||||
Reference in New Issue
Block a user