added new roles

This commit is contained in:
pyrschtjag committed 2026-10-18 12:34:19 +04:00
1 parent d10d28a0d7
commit 04bfb22e48
73 files changed
+990 -96

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
#bootstrap
#runner
+1
View File
@@ -5,6 +5,7 @@ host_key_checking = False
forks = 8
vault_password_file = ../inventory/.vault_pass
deprecation_warnings=False
timeout = 30
[inventory]
enable_plugins = community.proxmox.proxmox, host_list, yaml, ini
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: asf
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: asf
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- asf
- zabbix-agent2
-12
View File
@@ -1,12 +0,0 @@
---
- name: bootstrap ssh keys via pct on all proxmox LXC containers
hosts: proxmox_all_lxc
gather_facts: false
roles:
- authorized-key
- name: router-specific pct-only network bootstrap (before ssh is reachable)
hosts: router
gather_facts: false
roles:
- ifupdown2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: byparr
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: byparr
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- byparr
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: coturn
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: coturn
vars:
@@ -13,3 +19,4 @@
- locales
- coturn
- certbot
- zabbix-agent2
+1 -1
View File
@@ -12,7 +12,7 @@
-o PreferredAuthentications=publickey,password
-o PubkeyAuthentication=yes
roles:
- authorized-key
- authorized-key-root
- sshd
- sysctl
- hostname
+1 -1
View File
@@ -12,7 +12,7 @@
-o PreferredAuthentications=publickey,password
-o PubkeyAuthentication=yes
roles:
- authorized-key
- authorized-key-root
- sshd
- sysctl
- hostname
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: gitea
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: gitea
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- gitea
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: lampa
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: lampa
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- lampa
- zabbix-agent2
+3 -1
View File
@@ -12,7 +12,9 @@
-o PreferredAuthentications=publickey,password
-o PubkeyAuthentication=yes
roles:
- authorized-key
- authorized-key-root
- timezone
- locales
- sshd
- sysctl
- hostname
+25
View File
@@ -0,0 +1,25 @@
---
- name: configure via pct
hosts: minidlna
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: minidlna
vars:
ansible_connection: ssh
ansible_host: "{{ ip }}"
ansible_user: root
ansible_ssh_private_key_file: ~/.ssh/id_ed25519
ansible_ssh_common_args: >-
-o UserKnownHostsFile=/dev/null
-o StrictHostKeyChecking=no
-o PreferredAuthentications=publickey,password
-o PubkeyAuthentication=yes
roles:
- sshd
- timezone
- locales
- minidlna
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: nfs
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: nfs
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- nfs
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: nginx
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: nginx
vars:
@@ -13,3 +19,4 @@
- locales
- nginx
- certbot
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: ntfy
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: ntfy
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- ntfy
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: pgsql
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: pgsql
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- pgsql
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: prosody
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: prosody
vars:
@@ -13,3 +19,4 @@
- locales
- prosody
- certbot
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: prowlarr
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: prowlarr
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- prowlarr
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: ps3netsrv
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: ps3netsrv
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- ps3netsrv
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: radicale
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: radicale
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- radicale
- zabbix-agent2
+9
View File
@@ -1,4 +1,11 @@
---
- name: configure via pct
hosts: router
gather_facts: false
roles:
- ifupdown2
- authorized-key-root
- name: configure over ssh
hosts: router
vars:
@@ -25,4 +32,6 @@
- unbound
- resolv
- nftables
- udp-broadcast-relay
- netutils
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: rtorrent
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: rtorrent
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- rtorrent
- zabbix-agent2
+2 -1
View File
@@ -1,5 +1,5 @@
---
- name: deploy rasy-rsa
- name: configure local
hosts: localhost
connection: local
become: true
@@ -8,3 +8,4 @@
- timezone
- locales
- easy-rsa
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: slskd
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: slskd
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- slskd
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: smb-legacy
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: smb-legacy
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- samba
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: torrserver
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: torrserver
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- torrserver
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: valheim
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: valheim
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- valheim
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: vaultwarden
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: vaultwarden
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- vaultwarden
- zabbix-agent2
+1 -1
View File
@@ -12,7 +12,7 @@
-o PreferredAuthentications=publickey,password
-o PubkeyAuthentication=yes
roles:
- authorized-key
- authorized-key-root
- sshd
- sysctl
- hostname
+21
View File
@@ -0,0 +1,21 @@
---
- name: configure via pct
hosts: work
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: work
vars:
ansible_connection: ssh
ansible_host: "{{ ip }}"
ansible_user: root
ansible_ssh_private_key_file: ~/.ssh/id_ed25519
ansible_ssh_common_args: '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
roles:
- sshd
- timezone
- locales
- work
- zabbix-agent2
+7
View File
@@ -1,4 +1,10 @@
---
- name: configure via pct
hosts: zabbix
gather_facts: false
roles:
- authorized-key-root
- name: configure over ssh
hosts: zabbix
vars:
@@ -12,3 +18,4 @@
- timezone
- locales
- zabbix-server
- zabbix-agent2
File renamed without changes.
@@ -4,7 +4,6 @@ proto tcp
remote 127.0.0.1 1195
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
auth SHA256
@@ -12,8 +11,8 @@ cipher AES-256-GCM
verb 3
{% if item.1.ip is defined %}
route-metric {{ item.1.route_metric | default(50) }}
script-security 2
up "C:\\Windows\\System32\\netsh.exe interface ip set address name="OpenVPN TAP-Windows6" static {{ item.1.ip }} 255.255.255.0"
ip-win32 netsh
ifconfig {{ item.1.ip }} 255.255.255.0
{% endif %}
<ca>
{{ lookup('file', item.0.pki_dir + '/ca.crt') }}
+9
View File
@@ -106,3 +106,12 @@
group: lampac
mode: "0640"
notify: restart lampa
- name: deploy lampa init config
ansible.builtin.template:
src: "{{ inventory_hostname }}/lampainit.js.j2"
dest: /opt/lampac/module/LampaWeb/plugins/lampainit.js
owner: lampac
group: lampac
mode: "0640"
notify: restart lampa
+204
View File
@@ -0,0 +1,204 @@
(function() {
'use strict';
window.lampac_version = { major: 0, minor: 0 };
//localStorage.setItem('cub_mirrors', '["mirror-kurwa.men"]');
window.lampa_settings = window.lampa_settings || {};
window.lampa_settings.torrents_use = true; // Показывать кнопку торрентов
window.lampa_settings.demo = false; // demo off
window.lampa_settings.read_only = false; // Режим только для чтения, без кнопок онлайн и расширений
window.lampa_settings.socket_use = false; // cub - Использовать сокеты для синхронизации данных
window.lampa_settings.socket_url = undefined; // cub - Адрес сокета, по умолчанию лампа берет адреса из манифеста
window.lampa_settings.socket_methods = false; // cub - Обрабатывать сообщения сокетов
window.lampa_settings.account_use = false; // cub - Использовать аккаунты
window.lampa_settings.account_sync = false; // cub - Синхронизировать закладки, таймкоды и прочее
window.lampa_settings.plugins_store = false; // cub магазин расширений
window.lampa_settings.feed = false; // cub лента
window.lampa_settings.iptv = false; // Является ли приложение IPTV
window.lampa_settings.white_use = false; // Белая и пушистая лампа, для одобрения модерации
window.lampa_settings.push_state = true; // адрес в url /?card=1241982&media=movie
window.lampa_settings.lang_use = false; // Подключить другие языки интерфейса, по умолчанию только русский и английский
window.lampa_settings.plugins_use = true; // Разрешить установку плагинов и расширений
window.lampa_settings.dcma = false; // Добавить список блокировки карточек, пример: [{"id":3566556,"cat":"movie"},...]
window.lampa_settings.services = false; // Различные сервисы cub в приложении
window.lampa_settings.youtube = true; // Подключить YouTube API
window.lampa_settings.geo = false; // Определять гео по IP, иначе будет RU
window.lampa_settings.mirrors = true; // Использовать поиск зеркал
window.lampa_settings.disable_features = window.lampa_settings.disable_features || {};
window.lampa_settings.disable_features.dmca = true; // шлет нахер правообладателей - on
window.lampa_settings.disable_features.ads = true; // Вспомогатиленые сервисы на подписку према
window.lampa_settings.disable_features.reactions = false; // cub реакции
window.lampa_settings.disable_features.discuss = false; // cub комментарии
window.lampa_settings.disable_features.ai = false; // cub AI-поиск
window.lampa_settings.disable_features.install_proxy = false; // cub tmdb proxy
window.lampa_settings.disable_features.subscribe = false; // cub подписки
window.lampa_settings.disable_features.blacklist = false; // Черный список плагинов
window.lampa_settings.disable_features.persons = false; // Подписка на актеров
window.lampa_settings.disable_features.trailers = false; // Трейлеры
window.lampa_settings.disable_features.lgbt = true; // Разрешить ЛГБТ контент
window.lampa_settings.developer = window.lampa_settings.developer || {};
{lampainit-invc}
var timer = setInterval(function() {
if (typeof Lampa !== 'undefined') {
clearInterval(timer);
if (lampainit_invc)
lampainit_invc.appload();
if ({btn_priority_forced})
Lampa.Storage.set('full_btn_priority', '{full_btn_priority_hash}');
var unic_id = Lampa.Storage.get('lampac_unic_id', '');
if (!unic_id) {
unic_id = Lampa.Utils.uid(8).toLowerCase();
Lampa.Storage.set('lampac_unic_id', unic_id);
}
Lampa.Utils.putScriptAsync(["{localhost}/privateinit.js?account_email=" + encodeURIComponent(Lampa.Storage.get('account_email', '')) + "&uid=" + encodeURIComponent(Lampa.Storage.get('lampac_unic_id', ''))], function() {});
if (window.appready) {
start();
}
else {
Lampa.Listener.follow('app', function(e) {
if (e.type == 'ready') {
start();
}
});
}
{pirate_store}
}
}, 200);
function pluginBaseName(url) {
if (!url) return null;
var tokenized = url.match(/\/([a-z0-9_-]+)\/js\//i);
if (tokenized) return tokenized[1].toLowerCase();
var nested = url.match(/\/([a-z0-9_-]+)\/([a-z0-9_-]+)\.js(\?|$)/i);
if (nested) return nested[2].toLowerCase();
var flat = url.match(/\/([a-z0-9_-]+)\.js(\?|$)/i);
if (flat) return flat[1].toLowerCase();
return null;
}
function hasPluginFamily(installed, baseName) {
return installed.some(function (p) {
return pluginBaseName(p.url) === baseName;
});
}
var syncOrchestratorChildren = { bookmark: true, timecode: true };
function shouldSkipPlugin(plugin, installed) {
if (installed.some(function (p) { return p.url == plugin.url; }))
return true;
var base = pluginBaseName(plugin.url);
if (!base) return false;
if (hasPluginFamily(installed, base))
return true;
if (syncOrchestratorChildren[base] && hasPluginFamily(installed, 'sync'))
return true;
return false;
}
function cleanupFamilyDuplicates(plugins) {
if (typeof Lampa.Plugins.remove !== 'function')
return plugins;
var byBase = {};
plugins.forEach(function (p) {
var base = pluginBaseName(p.url);
if (!base) return;
if (!byBase[base]) byBase[base] = [];
byBase[base].push(p);
});
var changed = false;
Object.keys(byBase).forEach(function (base) {
var group = byBase[base];
var hasTokenized = group.some(function (p) { return /\/js\//.test(p.url); });
if (!hasTokenized) return;
group.forEach(function (p) {
if (/\/js\//.test(p.url)) return;
if (!/\.js(\?|$)/.test(p.url)) return;
Lampa.Plugins.remove(p.url);
changed = true;
});
});
if (changed)
Lampa.Plugins.save();
return Lampa.Plugins.get();
}
function start() {
{deny}
if (lampainit_invc) lampainit_invc.appready();
var first_initiale = !Lampa.Storage.get('lampac_initiale', 'false');
Lampa.Storage.set('parser_use', 'true');
Lampa.Storage.set('parser_torrent_type', 'prowlarr');
Lampa.Storage.set('prowlarr_url', 'https://{{ hostvars["prowlarr"].dnsmasq[0].name }}');
Lampa.Storage.set('prowlarr_key', '{{ hostvars["prowlarr"]["prowlarr_api_key"] }}');
Lampa.Storage.set('internal_torrclient', 'true');
Lampa.Storage.set('torrserver_url', 'https://{{ hostvars["torrserver"].dnsmasq[0].name }}');
Lampa.Storage.set('light_version', 'true');
//Lampa.Storage.set('keyboard_type', 'integrate');
Lampa.Storage.set('black_style', 'true');
if (first_initiale) {
Lampa.Storage.set('lampac_initiale', 'true');
Lampa.Storage.set('source', 'tmdb');
Lampa.Storage.set('video_quality_default', '1080');
Lampa.Storage.set('full_btn_priority', '{full_btn_priority_hash}');
Lampa.Storage.set('proxy_tmdb', '{country}' == 'RU');
Lampa.Storage.set('poster_size', 'w300');
//Lampa.Storage.set('parser_use', 'true');
//Lampa.Storage.set('jackett_url', '{jachost}');
//Lampa.Storage.set('jackett_key', '1');
//Lampa.Storage.set('parser_torrent_type', 'jackett');
}
// А плагины — каждый запуск: восстановление бэкапа из облака перезаписывает список целиком,
// и раньше флаг запрещал переустановку, то есть сервер исчезал для клиента навсегда.
// Добавляется только отсутствующее, так что повторный проход ничего не дублирует.
var plugins = Lampa.Plugins.get();
plugins = cleanupFamilyDuplicates(plugins);
var plugins_add = {initiale};
var plugins_push = [];
plugins_add.forEach(function(plugin) {
if (shouldSkipPlugin(plugin, plugins))
return;
Lampa.Plugins.add(plugin);
Lampa.Plugins.save();
plugins_push.push(plugin.url);
plugins.push(plugin);
});
if (plugins_push.length) Lampa.Utils.putScript(plugins_push, function() {}, function() {}, function() {}, true);
if (lampainit_invc && first_initiale)
lampainit_invc.first_initiale();
}
})();
+6
View File
@@ -0,0 +1,6 @@
---
- name: restart minidlna
ansible.builtin.systemd_service:
name: minidlna
state: restarted
enabled: true
+29
View File
@@ -0,0 +1,29 @@
---
- name: create media group
ansible.builtin.group:
name: media
gid: 1000
state: present
- name: add minidlna to media group
ansible.builtin.user:
name: minidlna
groups: media
append: true
notify: restart minidlna
- name: install minidlna
ansible.builtin.apt:
name: minidlna
state: latest
update_cache: true
notify: restart minidlna
- name: deploy minidlna config
ansible.builtin.template:
src: "{{ inventory_hostname }}/minidlna.conf.j2"
dest: /etc/minidlna.conf
owner: root
group: root
mode: "0644"
notify: restart minidlna
@@ -0,0 +1,14 @@
{% for media_dir in media_dirs %}
media_dir={{ media_dir.type }},{{ media_dir.path }}
{% endfor %}
port=8200
notify_interval=300
friendly_name=media
root_container=B
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg/Poster.jpg/poster.jpg
inotify=yes
strict_dlna=no
db_dir=/var/cache/minidlna
log_dir=/var/log/minidlna
log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
max_connections=50
+1
View File
@@ -4,6 +4,7 @@
name: nftables
state: latest
update_cache: true
notify: restart nftables
- name: ensure nftables.d directory exists
ansible.builtin.file:
@@ -26,6 +26,13 @@ table inet filter {
iifname tun0 ip saddr {{ hostvars['workuter']['ip'] }} oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 22 counter accept
iifname tun0 ip saddr {{ hostvars['oyacoi-odcm']['ip'] }} oifname tun0 ip daddr {{ hostvars['xiawrt']['ip'] }} tcp dport 22 counter accept
iifname tun0 ip saddr {{ hostvars['oyacoi-odcm']['ip'] }} oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 22 counter accept
iifname tun0 ip saddr {{ hostvars['nginx']['ip'] }} oifname tun0 ip daddr {{ hostvars['xiawrt']['ip'] }} tcp dport 8080 counter accept
iifname tun0 ip saddr {{ hostvars['zabbix']['ip'] }} oifname tun0 ip daddr {{ hostvars['xiawrt']['ip'] }} tcp dport 10050 counter accept
iifname tun0 ip saddr {{ hostvars['zabbix']['ip'] }} oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 10050 counter accept
iifname tun0 ip saddr 10.1.0.0/24 oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 80 counter accept
iifname tun0 ip saddr 10.1.0.0/24 oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 443 counter accept
iifname tun0 ip saddr 10.2.0.0/24 oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 80 counter accept
iifname tun0 ip saddr 10.2.0.0/24 oifname tun0 ip daddr {{ hostvars['rbpi4']['ip'] }} tcp dport 443 counter accept
}
chain output {
type filter hook output priority filter;
@@ -4,31 +4,38 @@ flowtable ft {
}
chain input {
type filter hook input priority filter; policy drop;
ct state established,related accept
ct state invalid drop
iif lo accept
meta mark 0x00000001 accept
iifname br-eth0 tcp dport 22 accept
iifname eth0.11 tcp dport 22 accept
iifname tun0 tcp dport 22 accept
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } tcp dport 61219 accept
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } udp dport 61219 accept
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } udp dport 53 accept
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } tcp dport 53 accept
iifname eth0.3 udp dport 67 accept
iifname eth1 udp dport 68 accept
ct state established,related counter accept comment "input: established/related"
ct state invalid counter drop comment "input: invalid"
iif lo counter accept comment "input: loopback"
meta mark 0x00000001 counter accept comment "input: marked packets"
iifname br-eth0 tcp dport 22 counter accept comment "br-eth0 -> router"
iifname eth0.11 tcp dport 22 counter accept comment "eth0.11 -> router"
iifname tun0 tcp dport 22 counter accept comment "tun0 -> router"
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } tcp dport 61219 counter accept comment "lan -> tproxy"
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } udp dport 61219 counter accept comment "lan -> tproxy"
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } udp dport 53 counter accept comment "lan -> dns"
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } tcp dport 53 counter accept comment "lan -> dns"
iifname { eth0.2, eth0.3 } udp dport 32108 counter accept comment "lan -> mihome broadcast"
iifname { br-eth0, eth0.2, eth0.12 } udp dport 1900 counter accept comment "lan -> minidlna"
iifname eth0.3 udp dport 67 counter accept comment "lan -> dhcp"
iifname eth1 udp dport 68 counter accept comment "wan -> dhcp"
include "/etc/nftables.d/90-input.nft"
}
chain forward {
type filter hook forward priority filter; policy drop;
ct state established,related accept
ct state invalid drop
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } oifname eth1 ct state new flow add @ft
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } oifname eth1 accept
tcp flags syn tcp option maxseg size set rt mtu
ct state established,related counter accept comment "forward: established/related"
ct state invalid counter drop comment "drop invalid"
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } oifname eth1 ct state new counter flow add @ft comment "lan -> eth0 flowtable offload"
iifname { br-eth0, eth0.2, eth0.3, eth0.4, eth0.10, eth0.11, eth0.12 } oifname eth1 counter accept comment "lan -> eth0"
iifname eth0.3 ip saddr {{ hostvars['camera0'].ip }} oifname "eth0.2" meta l4proto udp counter accept comment "camera0 -> eth0.2"
iifname eth0.2 oifname eth0.3 ip daddr {{ hostvars["camera0"].ip }} meta l4proto udp counter accept comment "eth0.2 -> camera0"
iifname { br-eth0, eth0.2 } oifname eth0.12 ip daddr {{ hostvars["minidlna"].ip }} tcp dport 8200 counter accept comment "lan -> minidlna"
iifname eth0.12 oifname { br-eth0, eth0.2 } ip saddr {{ hostvars["minidlna"].ip }} meta l4proto udp counter accept comment "minidlna -> lan"
tcp flags syn counter tcp option maxseg size set rt mtu comment "forward: mss clamp to route mtu"
include "/etc/nftables.d/90-forward.nft"
}
chain output {
type route hook output priority filter; policy accept;
oifname "eth0.3" ip daddr 10.2.0.255 udp dport 32108 counter ip daddr set 255.255.255.255 comment "camera0 broadcast rewrite"
include "/etc/nftables.d/90-output.nft"
}
@@ -18,6 +18,9 @@ server {
server_name {{ item_dnsmasq.name }};
ssl_certificate /etc/letsencrypt/live/oyacoi.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/oyacoi.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
access_log /var/log/nginx/{{ short_name }}_access.log;
error_log /var/log/nginx/{{ short_name }}_error.log;
{% for cidr in item_dnsmasq.nginx_allow | default([]) %}
@@ -0,0 +1,9 @@
server {
listen 127.0.0.1:8080;
location = /basic_status {
stub_status;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
+3 -3
View File
@@ -12,14 +12,14 @@
state: directory
owner: _ntfy
group: _ntfy
mode: '0750'
mode: "0750"
recurse: true
- name: deploy ntfy config
ansible.builtin.template:
src: "{{ inventory_hostname }}/server.yml.j2"
dest: "/etc/ntfy/server.yml"
dest: /etc/ntfy/server.yml
owner: root
group: root
mode: '0644'
mode: "0644"
notify: restart ntfy
@@ -10,7 +10,9 @@ auth SHA256
persist-key
persist-tun
status openvpn-tap0-status.log
verb 6
verb 3
tcp-nodelay
reneg-sec 0
tun-mtu 1500
mssfix 1300
script-security 2
+2 -2
View File
@@ -79,7 +79,7 @@
group: root
mode: "0755"
- name: stat prowlarr config in data dir
- name: stat prowlarr config in data directory
ansible.builtin.stat:
path: /var/lib/prowlarr/config.xml
register: prowlarr_config_stat
@@ -139,7 +139,7 @@
mode: "0640"
notify: restart prowlarr
- name: stat prowlarr config in data dir
- name: stat prowlarr config in data directory
ansible.builtin.stat:
path: /var/lib/prowlarr/data/config.xml
register: prowlarr_config_stat
+1 -1
View File
@@ -16,7 +16,7 @@
name: ps3netsrv
group: ps3netsrv
groups: media
append: yes
append: true
system: true
shell: /usr/sbin/nologin
home: /var/lib/ps3netsrv
+22 -46
View File
@@ -75,7 +75,7 @@
name: rtorrent
group: rtorrent
groups: media
append: yes
append: true
system: true
shell: /usr/sbin/nologin
home: /var/lib/rtorrent
@@ -86,7 +86,7 @@
ansible.builtin.user:
name: www-data
groups: rtorrent
append: yes
append: true
notify: restart apache
- name: ensure rtorrent data directory exists
@@ -169,7 +169,7 @@
group: rtorrent
recurse: true
- name: ensure ansible remote tmp dir exists
- name: ensure ansible remote tmp directory exists
ansible.builtin.file:
path: /tmp/.ansible-www-data
state: directory
@@ -177,16 +177,6 @@
group: www-data
mode: "0700"
- name: check current rutorrent git remote
ansible.builtin.command: git -C /var/www/html remote get-url origin
become: yes
become_user: www-data
register: current_remote
failed_when: false
changed_when: false
vars:
ansible_remote_tmp: /tmp/.ansible-www-data
- name: get latest rutorrent release info
ansible.builtin.uri:
url: "https://api.github.com/repos/Novik/ruTorrent/releases/latest"
@@ -205,47 +195,33 @@
changed_when: false
failed_when: false
- name: ensure html share directory is a mountpoint
ansible.builtin.command: mountpoint -q /var/www/html/share
register: share_mountpoint
failed_when: false
changed_when: false
- name: unmount rutorrent share directory before update
ansible.posix.mount:
path: /var/www/html/share
state: unmounted
when:
- share_mountpoint.rc == 0
- rutorrent_version not in (rutorrent_current_version.stdout | default(''))
- name: remove irrelevant html directory
ansible.builtin.file:
path: /var/www/html
state: absent
when:
- current_remote.rc is defined
- current_remote.rc != 0
- rutorrent_version not in (rutorrent_current_version.stdout | default(''))
- name: display rutorrent version info
ansible.builtin.debug:
msg: "latest version: {{ rutorrent_version }}, installed version: {{ rutorrent_current_version.stdout | default('not installed', true) }}"
- name: clone rutorrent
ansible.builtin.git:
repo: "https://github.com/Novik/ruTorrent.git"
dest: "/var/www/html"
version: "v{{ rutorrent_version }}"
force: yes
when: rutorrent_version not in (rutorrent_current_version.stdout | default(''))
- name: set rutorrent directory ownership
- name: ensure rutorrent directory exists
ansible.builtin.file:
path: /var/www/html
state: directory
owner: www-data
group: www-data
recurse: yes
mode: "0755"
- name: remove leftover git metadata from rutorrent directory
ansible.builtin.file:
path: /var/www/html/.git
state: absent
- name: install rutorrent release
ansible.builtin.unarchive:
src: "https://github.com/Novik/ruTorrent/archive/refs/tags/v{{ rutorrent_version }}.tar.gz"
dest: /var/www/html
remote_src: true
owner: www-data
group: www-data
extra_opts:
- --strip-components=1
- "--exclude=ruTorrent-{{ rutorrent_version }}/share"
when: rutorrent_version not in (rutorrent_current_version.stdout | default(''))
- name: remove default share directory
@@ -16,6 +16,6 @@
SetHandler "proxy:unix:/run/php/php{{ php_version.stdout }}-fpm.sock|fcgi://localhost"
</FilesMatch>
ProxyPass /RPC2 scgi://unix:/run/rtorrent/rpc.sock|
ProxyPassReverse /RPC2 scgi://unix:/run/rtorrent/rpc.sock|
ProxyPass /RPC2 unix:/run/rtorrent/rpc.sock|scgi://localhost
ProxyPassReverse /RPC2 unix:/run/rtorrent/rpc.sock|scgi://localhost
</VirtualHost>
@@ -3,6 +3,8 @@ setgid = stunnel4
pid = /var/run/stunnel4/absinthe.pid
output = /var/log/stunnel4/absinthe.log
[openvpn]
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
cert = /etc/letsencrypt/live/absinthe.oyacoi.ru/fullchain.pem
key = /etc/letsencrypt/live/absinthe.oyacoi.ru/privkey.pem
accept = 127.0.0.1:8444
@@ -4,6 +4,8 @@ pid = /var/run/stunnel4/absinthe.pid
output = /var/log/stunnel4/absinthe.log
client = yes
[openvpn]
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
sni = absinthe.oyacoi.ru
accept = 127.0.0.1:1195
connect = {{ hostvars['liqueur'].ip }}:443
@@ -1,2 +1,7 @@
net.ipv4.ip_forward = 1
net.ipv4.conf.all.route_localnet = 1
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_autocorking = 0
net.ipv6.conf.tap0.disable_ipv6=1
+1 -1
View File
@@ -8,7 +8,7 @@ Wants=network-online.target
Type=simple
User=torrserver
Group=torrserver
ExecStart=/opt/torrserver/TorrServer-linux-amd64 --path /var/lib/torrserver/data --logpath /var/lob/torrserver.log
ExecStart=/opt/torrserver/TorrServer-linux-amd64 --torrentaddr :32768 --path /var/lib/torrserver/data --logpath /var/lob/torrserver.log
Restart=on-failure
RestartSec=5
TimeoutStopSec=30
@@ -0,0 +1,10 @@
---
- name: restart udp-broadcast-relay
ansible.builtin.systemd:
name: "udp-broadcast-relay-{{ item.name }}"
state: restarted
enabled: true
daemon_reload: true
loop: "{{ udp_relay_instances }}"
loop_control:
label: "{{ item.name }}"
+44
View File
@@ -0,0 +1,44 @@
---
- name: install dependencies
ansible.builtin.apt:
name:
- git
- build-essential
state: latest
- name: fetch udp-broadcast-relay-redux sources
ansible.builtin.git:
repo: https://github.com/udp-redux/udp-broadcast-relay-redux.git
dest: /usr/local/src/udp-broadcast-relay-redux
version: "{{ udp_relay_version }}"
register: udp_relay_git
- name: ensure binary udp-broadcast-relay exists
ansible.builtin.stat:
path: /usr/local/src/udp-broadcast-relay-redux/udp-broadcast-relay-redux
register: udp_relay_built
- name: build udp-broadcast-relay-redux
ansible.builtin.command:
cmd: make
chdir: /usr/local/src/udp-broadcast-relay-redux
when: udp_relay_git.changed or not udp_relay_built.stat.exists
changed_when: true
- name: install udp-broadcast-relay
ansible.builtin.copy:
src: /usr/local/src/udp-broadcast-relay-redux/udp-broadcast-relay-redux
dest: /usr/local/sbin/udp-broadcast-relay-redux
mode: "0755"
remote_src: true
notify: restart udp-broadcast-relay
- name: depoloy systemd service unit
ansible.builtin.template:
src: "{{ inventory_hostname }}/udp-broadcast-relay.service.j2"
dest: "/etc/systemd/system/udp-broadcast-relay-{{ item.name }}.service"
mode: "0644"
loop: "{{ udp_relay_instances }}"
loop_control:
label: "{{ item.name }}"
notify: restart udp-broadcast-relay
@@ -0,0 +1,20 @@
[Unit]
Description=UDP broadcast relay {{ item.name }} ({{ item.devs | join(' <-> ') }}, udp/{{ item.port }})
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/sbin/udp-broadcast-relay-redux --id {{ item.id }} --port {{ item.port }}{% for dev in item.devs %} --dev {{ dev }}{% endfor %}{% if item.multicast is defined %} --multicast {{ item.multicast }}{% endif %}
Restart=on-failure
RestartSec=5
DynamicUser=yes
AmbientCapabilities=CAP_NET_RAW
CapabilityBoundingSet=CAP_NET_RAW
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
[Install]
WantedBy=multi-user.target
+1
View File
@@ -4,6 +4,7 @@
name: unbound
state: latest
update_cache: true
notify: restart unbound
- name: deploy unbound config
ansible.builtin.copy:
+12
View File
@@ -0,0 +1,12 @@
---
- name: restart sshd
ansible.builtin.systemd:
name: ssh
state: restarted
- name: restart openconnect
ansible.builtin.systemd:
name: openconnect-work
state: restarted
enabled: true
daemon_reload: true
+23
View File
@@ -0,0 +1,23 @@
---
- name: install dependencies
ansible.builtin.apt:
name:
- waypipe
- libpulse0
- pulseaudio-utils
- fonts-noto
- xdg-utils
- ca-certificates
- libnss3
- libgbm1
- libgtk-3-0t64
- libasound2t64
- libxss1
- libxtst6
- libatk-bridge2.0-0t64
- libcups2t64
- libxkbcommon0
- libxcb-cursor0
- libnotify-bin
state: latest
update_cache: true
+18
View File
@@ -0,0 +1,18 @@
---
- name: download element repo keyring
ansible.builtin.get_url:
url: https://packages.element.io/debian/element-io-archive-keyring.gpg
dest: /usr/share/keyrings/element-io-archive-keyring.gpg
mode: "0644"
- name: add element apt repository
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/element-io.list
content: "deb [signed-by=/usr/share/keyrings/element-io-archive-keyring.gpg] https://packages.element.io/debian/ default main\n"
mode: "0644"
- name: install element-desktop
ansible.builtin.apt:
name: element-desktop
state: latest
update_cache: true
+5
View File
@@ -0,0 +1,5 @@
---
- name: install firefox-esr
ansible.builtin.apt:
name: "{{ firefox_package | default('firefox-esr') }}"
state: latest
+40
View File
@@ -0,0 +1,40 @@
---
- name: include install dependencies
ansible.builtin.include_tasks:
file: dependencies.yml
- name: include mount home
ansible.builtin.include_tasks:
file: mount.yml
- name: include create user
ansible.builtin.include_tasks:
file: user.yml
- name: include configure ssh
ansible.builtin.include_tasks:
file: ssh.yml
- name: include install firefox
ansible.builtin.include_tasks:
file: firefox.yml
- name: include install thunderbird
ansible.builtin.include_tasks:
file: thunderbird.yml
- name: include install octobrowser
ansible.builtin.include_tasks:
file: octobrowser.yml
- name: include install octobrowser
ansible.builtin.include_tasks:
file: octobrowser.yml
- name: include install element
ansible.builtin.include_tasks:
file: element.yml
- name: include install openconnect
ansible.builtin.include_tasks:
file: openconnect.yml
+16
View File
@@ -0,0 +1,16 @@
---
- name: ensure {{ work_user }} home source directory exists
ansible.builtin.file:
path: "/mnt/work/{{ work_user }}"
state: directory
owner: "{{ work_user }}"
group: "{{ work_user }}"
mode: "0700"
- name: bind mount {{ work_user }} home directory
ansible.posix.mount:
path: "/home/{{ work_user }}"
src: "/mnt/work/{{ work_user }}"
fstype: none
opts: bind
state: mounted
+78
View File
@@ -0,0 +1,78 @@
---
- name: create octobrowser directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop:
- /opt/octobrowser
- /var/cache/octobrowser
- name: get octobrowser archive headers
ansible.builtin.uri:
url: https://binaries.octobrowser.org/releases/installer/OctoBrowser.linux.tar.gz
method: HEAD
register: octobrowser_head
check_mode: false
changed_when: false
- name: read previously installed archive id
ansible.builtin.slurp:
src: /var/cache/octobrowser/archive.id
register: octobrowser_stored_id
failed_when: false
- name: check octobrowser binary
ansible.builtin.stat:
path: /opt/octobrowser/OctoBrowser.AppImage
register: octobrowser_bin
- name: decide whether octobrowser needs update
ansible.builtin.set_fact:
octobrowser_remote_id: "{{ octobrowser_head.etag | default('') }}|{{ octobrowser_head.last_modified | default('') }}|{{ octobrowser_head.content_length | default('') }}"
octobrowser_need_update: >-
{{ not octobrowser_bin.stat.exists
or (octobrowser_stored_id.content | default('') | b64decode | trim)
!= ((octobrowser_head.etag | default('')) ~ '|' ~ (octobrowser_head.last_modified | default('')) ~ '|' ~ (octobrowser_head.content_length | default(''))) }}
- name: download octobrowser archive
ansible.builtin.get_url:
url: https://binaries.octobrowser.org/releases/installer/OctoBrowser.linux.tar.gz
dest: /var/cache/octobrowser/OctoBrowser.linux.tar.gz
force: true
mode: "0644"
when: octobrowser_need_update | bool
- name: unpack octobrowser archive
ansible.builtin.unarchive:
src: /var/cache/octobrowser/OctoBrowser.linux.tar.gz
dest: /opt/octobrowser
remote_src: true
owner: root
group: root
mode: "0755"
when: octobrowser_need_update | bool
- name: save octobrowser archive id
ansible.builtin.copy:
dest: /var/cache/octobrowser/archive.id
content: "{{ octobrowser_remote_id }}\n"
mode: "0644"
when: octobrowser_need_update | bool
- name: install octobrowser wrapper
ansible.builtin.copy:
dest: /usr/local/bin/octobrowser
owner: root
group: root
mode: "0755"
content: |
#!/bin/sh
export QT_QPA_PLATFORM=wayland
export QSG_RENDER_LOOP=basic
export QT_QUICK_BACKEND=software
export LIBGL_ALWAYS_SOFTWARE=1
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu --disable-gpu-compositing --disable-software-rasterizer --disable-webgpu --no-sandbox"
exec /opt/octobrowser/OctoBrowser.AppImage
+50
View File
@@ -0,0 +1,50 @@
---
- name: install openconnect
ansible.builtin.apt:
name: openconnect
state: latest
- name: create openconnect directory
ansible.builtin.file:
path: /etc/openconnect
state: directory
owner: root
group: root
mode: "0700"
- name: decrypt current vpn credential for comparison
ansible.builtin.command: systemd-creds decrypt --name=vpnpass /etc/openconnect/work.cred -
register: openconnect_cred_current
changed_when: false
failed_when: false
no_log: true
- name: remove outdated vpn credential
ansible.builtin.file:
path: /etc/openconnect/work.cred
state: absent
when: openconnect_cred_current.rc != 0 or (openconnect_cred_current.stdout | trim) != (openconnect_password | trim)
- name: encrypt vpn password
ansible.builtin.command:
cmd: systemd-creds encrypt --name=vpnpass - /etc/openconnect/work.cred
stdin: "{{ openconnect_password }}"
creates: /etc/openconnect/work.cred
no_log: true
notify: restart openconnect
- name: restrict vpn credential permissions
ansible.builtin.file:
path: /etc/openconnect/work.cred
owner: root
group: root
mode: "0600"
- name: deploy openconnect systemd service unit
ansible.builtin.template:
src: openconnect-work.service.j2
dest: /etc/systemd/system/openconnect-work.service
owner: root
group: root
mode: "0644"
notify: restart openconnect
+16
View File
@@ -0,0 +1,16 @@
---
- name: set authorized key
ansible.posix.authorized_key:
user: "{{ work_user }}"
key: "{{ work_ssh_key }}"
when: work_ssh_key | length > 0
- name: deploy sshd config
ansible.builtin.copy:
dest: /etc/ssh/sshd_config.d/00-work.conf
content: |
StreamLocalBindUnlink yes
AllowStreamLocalForwarding yes
SetEnv PULSE_SERVER=unix:/tmp/pulse.sock
mode: "0644"
notify: restart sshd
+5
View File
@@ -0,0 +1,5 @@
---
- name: install thunderbird
ansible.builtin.apt:
name: thunderbird
state: latest
+26
View File
@@ -0,0 +1,26 @@
---
- name: create {{ work_user }} group
ansible.builtin.group:
name: "{{ work_user }}"
system: true
state: present
- name: create {{ work_user }} user
ansible.builtin.user:
name: "{{ work_user }}"
group: "{{ work_user }}"
groups:
- audio
- video
append: true
create_home: false
home: "/home/{{ work_user }}"
shell: /usr/bin/bash
state: present
- name: set {{ work_user }} home directory ownership
ansible.builtin.file:
path: "/home/{{ work_user }}"
owner: "{{ work_user }}"
group: "{{ work_user }}"
mode: "0700"
@@ -0,0 +1,14 @@
[Unit]
Description=OpenConnect VPN (work)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
LoadCredentialEncrypted=vpnpass:/etc/openconnect/work.cred
ExecStart=/bin/sh -c 'exec /usr/sbin/openconnect --protocol=anyconnect --user={{ openconnect_user }} --passwd-on-stdin --non-inter {{ openconnect_server }} < "%d/vpnpass"'
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
+6
View File
@@ -0,0 +1,6 @@
---
- name: restart zabbix agent
ansible.builtin.systemd:
name: zabbix-agent2
state: restarted
enabled: true
+37
View File
@@ -0,0 +1,37 @@
---
- name: download zabbix package
ansible.builtin.get_url:
url: "https://repo.zabbix.com/zabbix/7.4/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.4+debian13_all.deb"
dest: "/tmp/zabbix-release_latest_7.4+debian13_all.deb"
mode: "0644"
- name: install zabbix release package
ansible.builtin.apt:
deb: "/tmp/zabbix-release_latest_7.4+debian13_all.deb"
state: present
- name: install zabbix server and frontend
ansible.builtin.apt:
name: zabbix-agent2
state: latest
update_cache: true
notify:
- restart zabbix agent
- name: install zabbix server and frontend
ansible.builtin.apt:
name: zabbix-agent2-plugin-postgresql
state: latest
update_cache: true
notify:
- restart zabbix agent
when: (zabbix_client_need_plugin_postgresql | default(false)) == true
- name: deploy zabbix client config
ansible.builtin.template:
src: zabbix_agent2.conf.j2
dest: /etc/zabbix/zabbix_agent2.conf
owner: root
group: root
mode: "0644"
notify: restart zabbix agent
@@ -0,0 +1,9 @@
PidFile=/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server={{ hostvars["zabbix"].ip }}
Hostname={{ inventory_hostname }}
PluginSocket=/run/zabbix/agent.plugin.sock
ControlSocket=/run/zabbix/agent.sock
Include=/etc/zabbix/zabbix_agent2.d/plugins.d/*.conf
Include=/etc/zabbix/zabbix_agent2.d/*.conf
+2 -2
View File
@@ -18,7 +18,7 @@
- php8.4-pgsql
- zabbix-apache-conf
- zabbix-sql-scripts
state: present
state: latest
update_cache: true
notify:
- restart zabbix server
@@ -37,7 +37,7 @@
dest: "/etc/zabbix/zabbix_server.d/{{ item | basename | regex_replace('\\.j2$', '') }}"
owner: root
group: root
mode: '0644'
mode: "0644"
loop: "{{ query('ansible.builtin.fileglob', role_path + '/templates/' + inventory_hostname + '/*.conf.j2') }}"
notify: restart zabbix server