Making sure formula works on openSUSEtags/v2.1.1
# vim: ft=yaml | # vim: ft=yaml | ||||
wireguard: | wireguard: | ||||
package: wireguard | |||||
packages: | |||||
- wireguard |
{% from "wireguard/map.jinja" import wireguard with context %} | |||||
wireguard_software: | |||||
pkg.installed: | |||||
- pkgs: | |||||
{%- for pkg in wireguard.packages %} | |||||
- {{ pkg }} | |||||
{%- endfor %} | |||||
{%- if wireguard.get('repository', False) %} | |||||
- require: | |||||
- pkgrepo: wireguard_repo | |||||
wireguard_repo: | |||||
pkgrepo.managed: | |||||
{%- for k,v in wireguard.repository.items() %} | |||||
- {{ k }}: {{ v }} | |||||
{%- endfor %} | |||||
{%- endif %} | |||||
{%- for interface_name, interface_dict in salt['pillar.get']('wireguard:interfaces', {}).items() %} | {%- for interface_name, interface_dict in salt['pillar.get']('wireguard:interfaces', {}).items() %} | ||||
{% if interface_dict.get('delete', False) %} | {% if interface_dict.get('delete', False) %} | ||||
- enable: True | - enable: True | ||||
- watch: | - watch: | ||||
- file: wireguard_interface_{{interface_name}}_config | - file: wireguard_interface_{{interface_name}}_config | ||||
- require: | |||||
- pkg: wireguard_software | |||||
{% endif %} | {% endif %} | ||||
{% if interface_dict.get('raw_config') %} | {% if interface_dict.get('raw_config') %} | ||||
wireguard_interface_{{interface_name}}_config: | wireguard_interface_{{interface_name}}_config: | ||||
file.managed: | file.managed: | ||||
- name: /etc/wireguard/{{interface_name}}.conf | - name: /etc/wireguard/{{interface_name}}.conf | ||||
- makedirs: True | |||||
- contents_pillar: wireguard:interfaces:{{interface_name}}:raw_config | - contents_pillar: wireguard:interfaces:{{interface_name}}:raw_config | ||||
- mode: 600 | - mode: 600 | ||||
{% else %} | {% else %} | ||||
wireguard_interface_{{interface_name}}_config: | wireguard_interface_{{interface_name}}_config: | ||||
file.managed: | file.managed: | ||||
- name: /etc/wireguard/{{interface_name}}.conf | - name: /etc/wireguard/{{interface_name}}.conf | ||||
- makedirs: True | |||||
- source: salt://wireguard/files/wg.conf | - source: salt://wireguard/files/wg.conf | ||||
- template: jinja | - template: jinja | ||||
- context: | - context: |
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# vim: ft=jinja | # vim: ft=jinja | ||||
{% import_yaml "wireguard/defaults.yaml" as defaults %} | |||||
{#- Start with defaults from defaults.yaml #} | |||||
{% import_yaml "wireguard/defaults.yaml" as default_settings %} | |||||
{% import_yaml "wireguard/osarchmap.yaml" as osarchmap %} | |||||
{% import_yaml "wireguard/osfamilymap.yaml" as osfamilymap %} | |||||
{% import_yaml "wireguard/osmap.yaml" as osmap %} | |||||
{% import_yaml "wireguard/osfingermap.yaml" as osfingermap %} | |||||
{% set wireguard = salt['grains.filter_by'](default_settings, | |||||
default='wireguard', | |||||
merge=salt['grains.filter_by'](osfamilymap, grain='os_family', | |||||
merge=salt['grains.filter_by'](osmap, grain='os', | |||||
merge=salt['grains.filter_by'](osfingermap, grain='osfinger', | |||||
merge=salt['grains.filter_by'](salt['grains.filter_by'](osarchmap, grain='osfinger'), grain='osarch') | |||||
) | |||||
) | |||||
) | |||||
) %} | |||||
{% set wireguard = salt['grains.filter_by']( | |||||
defaults, | |||||
base='wireguard') | |||||
%} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=yaml | |||||
# | |||||
# Setup variables using grains['osarch'] based logic. | |||||
# You just need to add the key:values for an `osarch` that differ | |||||
# from `defaults.yaml`. | |||||
# Only add an `osarch` which is/will be supported by the formula. | |||||
# | |||||
# If you do not need to provide defaults via the `osarch` grain, | |||||
# you will need to provide at least an empty dict in this file, e.g. | |||||
# osarch: {} | |||||
--- | |||||
Leap-15: | |||||
aarch64: | |||||
repository: | |||||
name: wireguard | |||||
humanname: Wireguard VPN | |||||
baseurl: https://download.opensuse.org/repositories/network:/vpn:/wireguard/openSUSE_Leap_15.1_ARM | |||||
gpgautoimport: True | |||||
gpgkey: https://download.opensuse.org/repositories/network:/vpn:/wireguard/openSUSE_Leap_15.1/repodata/repomd.xml.key | |||||
gpgcheck: 1 | |||||
x86_64: | |||||
repository: | |||||
name: wireguard | |||||
humanname: Wireguard VPN | |||||
baseurl: https://download.opensuse.org/repositories/network:/vpn:/wireguard/openSUSE_Leap_15.1 | |||||
gpgautoimport: True | |||||
gpgkey: https://download.opensuse.org/repositories/network:/vpn:/wireguard/openSUSE_Leap_15.1/repodata/repomd.xml.key | |||||
gpgcheck: 1 | |||||
default: | |||||
default: {} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=yaml | |||||
# | |||||
# Setup variables using grains['os_family'] based logic. | |||||
# You just need to add the key:values for an `os_family` that differ | |||||
# from `defaults.yaml` + `osarch.yaml`. | |||||
# Only add an `os_family` which is/will be supported by the formula. | |||||
# | |||||
# If you do not need to provide defaults via the `os_family` grain, | |||||
# you will need to provide at least an empty dict in this file, e.g. | |||||
# osfamilymap: {} | |||||
--- | |||||
default: {} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=yaml | |||||
# | |||||
# Setup variables using grains['osfinger'] based logic. | |||||
# You just need to add the key:values for an `osfinger` that differ | |||||
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml` + `osmap.yaml`. | |||||
# Only add an `osfinger` which is/will be supported by the formula. | |||||
# | |||||
# If you do not need to provide defaults via the `os_finger` grain, | |||||
# you will need to provide at least an empty dict in this file, e.g. | |||||
# osfingermap: {} | |||||
--- | |||||
# os: Debian | |||||
Debian-10: {} | |||||
Debian-9: {} | |||||
Debian-8: {} | |||||
# os: Ubuntu | |||||
Ubuntu-18.04: {} | |||||
Ubuntu-16.04: {} | |||||
# os: Fedora | |||||
Fedora-31: {} | |||||
Fedora-30: {} | |||||
# os: CentOS | |||||
CentOS Linux-8: {} | |||||
CentOS Linux-7: {} | |||||
CentOS-6: {} | |||||
# os: Amazon | |||||
Amazon Linux-2: {} | |||||
Amazon Linux AMI-2018: {} | |||||
# os: SUSE | |||||
Leap-15: | |||||
packages: | |||||
- wireguard-tools | |||||
- wireguard-kmp-default | |||||
# os: FreeBSD | |||||
FreeBSD-12: {} | |||||
# os: Windows | |||||
Windows-8.1: {} | |||||
# os: Gentoo | |||||
Gentoo-2: {} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=yaml | |||||
# | |||||
# Setup variables using grains['os'] based logic. | |||||
# You just need to add the key:values for an `os` that differ | |||||
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml`. | |||||
# Only add an `os` which is/will be supported by the formula. | |||||
# | |||||
# If you do not need to provide defaults via the `os` grain, | |||||
# you will need to provide at least an empty dict in this file, e.g. | |||||
# osmap: {} | |||||
--- | |||||
# os_family: Debian | |||||
Ubuntu: {} | |||||
Raspbian: {} | |||||
# os_family: RedHat | |||||
Fedora: {} | |||||
CentOS: {} | |||||
Amazon: {} | |||||
# os_family: Suse | |||||
SUSE: | |||||
packages: | |||||
- wireguard-tools | |||||
# os_family: Gentoo | |||||
Funtoo: {} | |||||
# os_family: Arch | |||||
Manjaro: {} | |||||
# os_family: Solaris | |||||
SmartOS: {} | |||||
default: {} |