This commit is contained in:
=
2022-11-02 11:18:20 +01:00
parent 1fddef7a97
commit 20c3717a10
43 changed files with 1201 additions and 472 deletions

View File

@@ -0,0 +1,3 @@
{% for key, value in pillar['voucher']['config'].items() -%}
{{ key }}="{{ value }}"
{% endfor -%}

View File

@@ -0,0 +1,13 @@
[Unit]
Description=WIFI-Voucher system for my guest network
After=network.target
[Service]
Type=simple
Restart=always
User=voucher
ExecStart=/usr/local/bin/voucher
EnvironmentFile=/etc/default/wifi-voucher
[Install]
WantedBy=multi-user.target

4
wifi-voucher/init.sls Normal file
View File

@@ -0,0 +1,4 @@
include:
- wifi-voucher.packages
- wifi-voucher.user
- wifi-voucher.service

View File

@@ -0,0 +1,9 @@
Install CUPS and bsd tools:
pkg.installed:
- pkgs:
- cups
- cups-bsd
Install wifi-voucher:
pip.installed:
- name: https://git.rre.nu/jonas/wifi-voucher/raw/branch/main/dist/voucher-{{ pillar['voucher']['version'] }}-py39-none-any.whl

4
wifi-voucher/remove.sls Normal file
View File

@@ -0,0 +1,4 @@
remove voucher user:
user.absent:
- name: voucher
- purge: True

31
wifi-voucher/service.sls Normal file
View File

@@ -0,0 +1,31 @@
WIFI-Voucher Unit environment file:
file.managed:
- name: /etc/default/wifi-voucher
- source: salt://wifi-voucher/files/voucher.env.jinja
- template: jinja
- user: root
- group: voucher
- mode: "0640"
WIFI-Voucher unit service file:
file.managed:
- name: /etc/systemd/system/wifi-voucher.service
- source: salt://wifi-voucher/files/wifi-voucher.service
- user: root
- group: root
- mode: "0644"
SystemD Reload:
cmd.run:
- name: systemctl --system daemon-reload
- onchanges:
- file: WIFI-Voucher unit service file
Start wifi-voucher:
service.running:
- name: wifi-voucher
- enable: True
- watch:
- file: WIFI-Voucher Unit environment file
- file: WIFI-Voucher unit service file
- cmd: SystemD Reload

8
wifi-voucher/user.sls Normal file
View File

@@ -0,0 +1,8 @@
WIFI-Voucher user:
user.present:
- name: voucher
- fullname: wifi-voucher system
- home: /home/voucher
- shell: /bin/bash
- groups:
- gpio