mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
dynamic annotations
This commit is contained in:
11
salt/soc/dynamic_annotations/hypervisor/add_node
Normal file
11
salt/soc/dynamic_annotations/hypervisor/add_node
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
hostname:
|
||||||
|
network_mode:
|
||||||
|
ip4:
|
||||||
|
gw4:
|
||||||
|
dns4:
|
||||||
|
sarch4:
|
||||||
|
cpu:
|
||||||
|
memory:
|
||||||
|
disk:
|
||||||
|
copper:
|
||||||
|
sfp:
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
hypervisor:
|
hypervisor:
|
||||||
hosts:
|
hosts:
|
||||||
defaultHost:
|
defaultHost:
|
||||||
add_guest:
|
add_searchnode:
|
||||||
description: Add a new guest to the hypervisor.
|
description: Add a new searchnode to the hypervisor.
|
||||||
forcedType: "[]string"
|
file: True
|
||||||
|
global: True
|
||||||
|
multiline: True
|
||||||
|
add_sensor:
|
||||||
|
description: Add a new sensor to the hypervisor.
|
||||||
|
file: True
|
||||||
global: True
|
global: True
|
||||||
multiline: True
|
multiline: True
|
||||||
guests:
|
guests:
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
|
{% from 'soc/dynamic_annotations/hypervisor/map.jinja' import HYPERVISORS %}
|
||||||
|
|
||||||
hypervisor_annotation:
|
hypervisor_annotation:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: /opt/so/saltstack/default/salt/hypervisor/soc_hypervisor.yaml
|
- name: /opt/so/saltstack/default/salt/hypervisor/soc_hypervisor.yaml
|
||||||
- source: salt://soc/dynamic_annotations/hypervisor/soc_hypervisor.yaml.jinja
|
- source: salt://soc/dynamic_annotations/hypervisor/soc_hypervisor.yaml.jinja
|
||||||
- template: jinja
|
- template: jinja
|
||||||
|
- defaults:
|
||||||
|
HYPERVISORS: {{ HYPERVISORS }}
|
||||||
|
|
||||||
|
{% for role in HYPERVISORS %}
|
||||||
|
{% for hypervisor in HYPERVISORS[role].keys() %}
|
||||||
|
hypervisor_host_directory_{{hypervisor}}:
|
||||||
|
file.directory:
|
||||||
|
- name: /opt/so/saltstack/local/salt/hypervisor/hosts/{{hypervisor}}
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
|
add_searchnode_file_{{hypervisor}}:
|
||||||
|
file.managed:
|
||||||
|
- name: /opt/so/saltstack/local/salt/hypervisor/hosts/{{hypervisor}}/add_searchnode
|
||||||
|
- source: salt://soc/dynamic_annotations/hypervisor/add_node
|
||||||
|
|
||||||
|
add_sensor_file_{{hypervisor}}:
|
||||||
|
file.managed:
|
||||||
|
- name: /opt/so/saltstack/local/salt/hypervisor/hosts/{{hypervisor}}/add_sensor
|
||||||
|
- source: salt://soc/dynamic_annotations/hypervisor/add_node
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|||||||
1
salt/soc/dynamic_annotations/hypervisor/map.jinja
Normal file
1
salt/soc/dynamic_annotations/hypervisor/map.jinja
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{% set HYPERVISORS = salt['pillar.get']('hypervisor:nodes', {}) %}
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
{% import_yaml 'soc/dynamic_annotations/hypervisor/hypervisor.yaml' as ANNOTATION %}
|
{% import_yaml 'soc/dynamic_annotations/hypervisor/hypervisor.yaml' as ANNOTATION %}
|
||||||
{% set HYPERVISORS = salt['pillar.get']('hypervisor:nodes', {}) %}
|
|
||||||
|
|
||||||
{% set TEMPLATE = ANNOTATION.hypervisor.hosts.pop('defaultHost') %}
|
{% set TEMPLATE = ANNOTATION.hypervisor.hosts.pop('defaultHost') %}
|
||||||
{# remove defaultGuest so that it is not shown in Grid Configuration UI #}
|
{# remove defaultGuest so that it is not shown in Grid Configuration UI #}
|
||||||
{% do TEMPLATE['guests'].pop('defaultGuest') %}
|
{% do TEMPLATE['guests'].pop('defaultGuest') %}
|
||||||
|
|
||||||
{% for hypervisor in HYPERVISORS.hypervisor %}
|
{% for role in HYPERVISORS %}
|
||||||
{% do ANNOTATION.hypervisor.hosts.update({hypervisor: TEMPLATE}) %}
|
{% for hypervisor in HYPERVISORS[role].keys() %}
|
||||||
|
{% do ANNOTATION.hypervisor.hosts.update({hypervisor: TEMPLATE}) %}
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{{ ANNOTATION | yaml(False) }}
|
{{ ANNOTATION | yaml(False) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user