mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +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:
|
||||
hosts:
|
||||
defaultHost:
|
||||
add_guest:
|
||||
description: Add a new guest to the hypervisor.
|
||||
forcedType: "[]string"
|
||||
add_searchnode:
|
||||
description: Add a new searchnode to the hypervisor.
|
||||
file: True
|
||||
global: True
|
||||
multiline: True
|
||||
add_sensor:
|
||||
description: Add a new sensor to the hypervisor.
|
||||
file: True
|
||||
global: True
|
||||
multiline: True
|
||||
guests:
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
{% from 'soc/dynamic_annotations/hypervisor/map.jinja' import HYPERVISORS %}
|
||||
|
||||
hypervisor_annotation:
|
||||
file.managed:
|
||||
- name: /opt/so/saltstack/default/salt/hypervisor/soc_hypervisor.yaml
|
||||
- source: salt://soc/dynamic_annotations/hypervisor/soc_hypervisor.yaml.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 %}
|
||||
{% set HYPERVISORS = salt['pillar.get']('hypervisor:nodes', {}) %}
|
||||
|
||||
{% set TEMPLATE = ANNOTATION.hypervisor.hosts.pop('defaultHost') %}
|
||||
{# remove defaultGuest so that it is not shown in Grid Configuration UI #}
|
||||
{% do TEMPLATE['guests'].pop('defaultGuest') %}
|
||||
|
||||
{% for hypervisor in HYPERVISORS.hypervisor %}
|
||||
{% do ANNOTATION.hypervisor.hosts.update({hypervisor: TEMPLATE}) %}
|
||||
{% for role in HYPERVISORS %}
|
||||
{% for hypervisor in HYPERVISORS[role].keys() %}
|
||||
{% do ANNOTATION.hypervisor.hosts.update({hypervisor: TEMPLATE}) %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{{ ANNOTATION | yaml(False) }}
|
||||
|
||||
Reference in New Issue
Block a user