Skip to content

Commit

Permalink
Initialize TAYGA formula
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Pfuetzenreuter <[email protected]>
  • Loading branch information
tacerus committed Oct 26, 2023
1 parent 93d610d commit e259555
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tayga-formula/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Salt states for TAYGA

## Available states

`tayga`

Installs and configures [TAYGA](http://www.litech.org/tayga/).
5 changes: 5 additions & 0 deletions tayga-formula/metadata/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
summary:
Salt states for managing TAYGA
description:
Salt states for managing the TAYGA NAT64 daemon
29 changes: 29 additions & 0 deletions tayga-formula/tayga/files/etc/tayga.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ pillar.get('managed_by_salt_formula', '# Managed by the TAYGA formula') }}

{#- SUSE default settings #}
data-dir /var/lib/tayga

{#- Mandatory settings #}
tun-device {{ tayga.get('tun-device', 'nat64') }}

{#- Optional settings #}
{%- if 'ipv4-addr' in tayga %}
ipv4-addr {{ tayga['ipv4-addr'] }}
{%- endif %}
{%- if 'ipv6-addr' in tayga %}
ipv6-addr {{ tayga['ipv6-addr'] }}
{%- endif %}

{%- if 'prefix' in tayga %}
prefix {{ tayga['prefix'] }}
{%- endif %}

{%- if 'dynamic-pool' in tayga %}
dynamic-pool {{ tayga['dynamic-pool'] }}
{%- endif %}

{%- if 'maps' in tayga and tayga['maps'] is mapping %}
{%- for map_from, map_to in tayga['maps'].items() %}
map {{ map_from }} {{ map_to }}
{%- endfor %}
{%- endif %}
43 changes: 43 additions & 0 deletions tayga-formula/tayga/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{#-
Salt state file for managing TAYGA
Copyright (C) 2023 Georg Pfuetzenreuter <mail+opensuse@georg-pfuetzenreuter.net>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-#}

{%- set tayga = salt.pillar.get('tayga', {}) %}

tayga_package:
pkg.installed:
- name: tayga

{%- if tayga %}
tayga_configuration:
file.managed:
- name: /etc/tayga.conf
- source: salt://{{ slspath }}/files/etc/tayga.conf.j2
- template: jinja
- context:
tayga: {{ tayga }}

tayga_service:
service.running:
- name: tayga
- enable: true
- reload: false
- require:
- pkg: tayga_package
- watch:
- file: tayga_configuration
{%- endif %}
12 changes: 12 additions & 0 deletions tayga-formula/tayga/pillar.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tayga:
# Mandatory settings (if not set, the shown default will be written)
tun-device: nat64

# Optional settings (if not set, the lines will be omitted)
ipv4-addr: 192.168.255.1
ipv6-addr: 2001:db8:1::2
prefix: 64:ff9b::/96
dynamic-pool: 192.168.255.0/24
maps:
192.168.255.10: 2001:db8:1::10
192.168.255.15: 2001:db8:1::a

0 comments on commit e259555

Please sign in to comment.