set interface for hypervisor/managerhype

This commit is contained in:
Josh Patterson
2025-04-01 09:27:50 -04:00
parent a60e55e5cd
commit b22fe5bd3d
3 changed files with 12 additions and 7 deletions

View File

@@ -3,6 +3,13 @@
https://securityonion.net/license; you may not use this file except in compliance with the https://securityonion.net/license; you may not use this file except in compliance with the
Elastic License 2.0. #} Elastic License 2.0. #}
{% set role = salt['grains.get']('role', '') %}
{% if role in ['so-hypervisor','so-managerhype'] and salt['network.ip_addrs']('br0')|length > 0 %}
{% set interface = 'br0' %}
{% else %}
{% set interface = pillar.host.mainint %}
{% endif %}
{% import_yaml 'salt/minion.defaults.yaml' as saltminion %} {% import_yaml 'salt/minion.defaults.yaml' as saltminion %}
{% set SALTVERSION = saltminion.salt.minion.version | string %} {% set SALTVERSION = saltminion.salt.minion.version | string %}
{% set INSTALLEDSALTVERSION = grains.saltversion | string %} {% set INSTALLEDSALTVERSION = grains.saltversion | string %}

View File

@@ -7,12 +7,8 @@
# GLOBALS are imported in the salt.minion state and that is not available at that point in setup # GLOBALS are imported in the salt.minion state and that is not available at that point in setup
# this state is included in the salt.minion state # this state is included in the salt.minion state
{% set role = salt['grains.get']('role', '') %} {% from 'salt/map.jinja' import interface %}
{% if role in ['so-hypervisor','so-managerhype'] and salt['network.ip_addrs']('br0')|length > 0 %} {% from 'salt/map.jinja' import role %}
{% set interface = 'br0' %}
{% else %}
{% set interface = pillar.host.mainint %}
{% endif %}
mine_functions: mine_functions:
file.managed: file.managed:

View File

@@ -1,3 +1,5 @@
{% from 'salt/map.jinja' import interface -%}
[Unit] [Unit]
Description=The Salt Minion Description=The Salt Minion
Documentation=man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html Documentation=man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html
@@ -8,7 +10,7 @@ KillMode=process
Type=notify Type=notify
NotifyAccess=all NotifyAccess=all
LimitNOFILE=8192 LimitNOFILE=8192
ExecStartPre=/bin/bash -c 'until /sbin/ip -4 addr show dev {{ salt["pillar.get"]("host:mainint") }} | grep -q "inet "; do sleep 1; done' ExecStartPre=/bin/bash -c 'until /sbin/ip -4 addr show dev {{ interface }} | grep -q "inet "; do sleep 1; done'
ExecStart=/usr/bin/salt-minion ExecStart=/usr/bin/salt-minion
TimeoutStartSec=120 TimeoutStartSec=120