chore: move port forward to dom0 formula

The script can be used with sys-cacher, sys-pihole, sys-syncthing,
sys-ssh and many services you'd want to forward, make it reusable.
This commit is contained in:
Ben Grande 2024-01-29 12:11:51 +01:00
parent 30f2ebe4ce
commit b01f2d213a
5 changed files with 30 additions and 9 deletions

View File

@ -8,6 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
include: include:
- .install - .install
- .port-forward
- .backup - .backup
- .xorg - .xorg
- .kde - .kde

View File

@ -0,0 +1,18 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{% if grains['nodename'] == 'dom0' -%}
"{{ slsdotpath }}-port-forward-script":
file.managed:
- name: /usr/local/bin/qvm-port-forward
- source: salt://{{ slsdotpath }}/files/bin/qvm-port-forward
- mode: "0755"
- user: root
- group: root
- makedirs: True
{% endif -%}

View File

@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'dom0':
- match: nodegroup
- dom0.port-forward

View File

@ -10,6 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
include: include:
- .clone - .clone
- browser.create - browser.create
- dom0.port-forward
{% load_yaml as defaults -%} {% load_yaml as defaults -%}
name: tpl-{{ slsdotpath }} name: tpl-{{ slsdotpath }}
@ -100,12 +101,3 @@ features:
{% from 'utils/macros/policy.sls' import policy_set with context -%} {% from 'utils/macros/policy.sls' import policy_set with context -%}
{{ policy_set(sls_path, '80') }} {{ policy_set(sls_path, '80') }}
"{{ slsdotpath }}-qvm-port-forward":
file.managed:
- name: /usr/local/bin/qvm-port-forward
- source: salt://{{ slsdotpath }}/files/admin/firewall/qvm-port-forward
- user: root
- group: root
- mode: '0755'
- makedirs: True