diff --git a/pillars/roles/mount/aurrepo.sls b/pillars/roles/mount/aurblobs.sls
similarity index 100%
rename from pillars/roles/mount/aurrepo.sls
rename to pillars/roles/mount/aurblobs.sls
diff --git a/pillars/roles/mount/transmission.sls b/pillars/roles/mount/transmission.sls
new file mode 100644
index 0000000..586869b
--- /dev/null
+++ b/pillars/roles/mount/transmission.sls
@@ -0,0 +1,7 @@
+mount:
+ sshfs:
+ /mnt/video:
+ name: video
+ host: host.actcur.com
+ directory: /mnt/butter/video
+ user: mount
\ No newline at end of file
diff --git a/pillars/roles/nginx/transmission.sls b/pillars/roles/nginx/transmission.sls
new file mode 100644
index 0000000..d3bafc9
--- /dev/null
+++ b/pillars/roles/nginx/transmission.sls
@@ -0,0 +1,14 @@
+nginx:
+ transmission:
+ auth: 2fa
+ default: no
+ https:
+ port: 9091
+ prot: http
+
+portal:
+ Media:
+ transmission:
+ name: Torrents
+ summary: Transmission Torrent Server
+ public: false
diff --git a/pillars/roles/services/aurrepo.sls b/pillars/roles/services/aurrepo.sls
deleted file mode 100644
index 313499a..0000000
--- a/pillars/roles/services/aurrepo.sls
+++ /dev/null
@@ -1,3 +0,0 @@
-services:
- aurrepo:
- updateaur.timer: []
diff --git a/pillars/servers/env/server/transmission.sls b/pillars/servers/env/server/transmission.sls
new file mode 100644
index 0000000..2fdef9a
--- /dev/null
+++ b/pillars/servers/env/server/transmission.sls
@@ -0,0 +1 @@
+env: prod
diff --git a/pillars/servers/roles/server/arr.sls b/pillars/servers/roles/server/arr.sls
index 56d06ba..1ab8ea6 100644
--- a/pillars/servers/roles/server/arr.sls
+++ b/pillars/servers/roles/server/arr.sls
@@ -10,3 +10,4 @@ grains:
- lidarr
- jackett
- ytdownloader
+ - podfox
diff --git a/pillars/servers/roles/server/pkg.sls b/pillars/servers/roles/server/pkg.sls
index 7fd25e3..c17476c 100644
--- a/pillars/servers/roles/server/pkg.sls
+++ b/pillars/servers/roles/server/pkg.sls
@@ -5,5 +5,5 @@ grains:
- nrpe
- saltminion
- pkg-cache
- - aurrepo
+ - aurblobs
- nginx-proxy
diff --git a/pillars/servers/roles/server/transmission.sls b/pillars/servers/roles/server/transmission.sls
new file mode 100644
index 0000000..1165323
--- /dev/null
+++ b/pillars/servers/roles/server/transmission.sls
@@ -0,0 +1,8 @@
+grains:
+ roles:
+ - server
+ - nrpe
+ - saltminion
+ - nginx-proxy
+ - windscribe
+ - transmission
diff --git a/states/roles/maintain/aurrepo/init.sls b/states/roles/maintain/aurblobs/init.sls
similarity index 78%
rename from states/roles/maintain/aurrepo/init.sls
rename to states/roles/maintain/aurblobs/init.sls
index b7654da..250b71f 100644
--- a/states/roles/maintain/aurrepo/init.sls
+++ b/states/roles/maintain/aurblobs/init.sls
@@ -4,6 +4,17 @@ base-devel:
sudo:
pkg.installed
+python-pip:
+ pkg.installed
+
+docker:
+ pkg.installed
+
+install_aurblobs:
+ pip.installed:
+ - name: aurblobs
+ - upgrade: true
+
{% if pillar['aur'] is defined -%}
{% if pillar['aur']['require'] is defined -%}
{% for pkg in pillar['aur']['require'] %}
@@ -30,19 +41,7 @@ user-build:
file.symlink:
- target: /mnt/build/
-git-aur_repo:
- git.latest:
- - name: https://git.actcur.com/actcur/aur_repo
- - target: /home/build/aur_repo
- - user: build
-build-aur_repo:
- cmd.run:
- - name: "makepkg -si --noconfirm;git reset --hard;git clean -f"
- - runas: build
- - cwd: /home/build/aur_repo
- - onchanges:
- - git: git-aur_repo
/etc/aur_repo/pkglist:
file.managed:
diff --git a/states/roles/maintain/aurblobs/init.sls.save b/states/roles/maintain/aurblobs/init.sls.save
new file mode 100644
index 0000000..fd6aa5a
--- /dev/null
+++ b/states/roles/maintain/aurblobs/init.sls.save
@@ -0,0 +1,71 @@
+base-devel:
+ pkg.group_installed
+
+sudo:
+ pkg.installed
+
+python-pip:
+ pkg.installed
+
+docker:
+ pkg.installed
+
+install_aurblobs:
+ pip.installed:
+ - name: aurblobs
+ - upgrade: truere
+
+{% if pillar['aur'] is defined -%}
+{% if pillar['aur']['require'] is defined -%}
+{% for pkg in pillar['aur']['require'] %}
+aur_require_{{pkg}}:
+ pkg.installed:
+ - name: "{{pkg}}"
+{%- endfor -%}
+{%- endif -%}
+{%- endif %}
+
+user-build:
+ user.present:
+ - name: build
+ - createhome: true
+ file.append:
+ - name: /etc/sudoers
+ - text: "build ALL=(ALL) NOPASSWD: ALL"
+
+/repo:
+ file.symlink:
+ - target: /mnt/pkgs/aur-local/os/x86_64/
+
+/build:
+ file.symlink:
+ - target: /mnt/build/
+
+
+
+/etc/aur_repo/pkglist:
+ file.managed:
+ - source: salt://roles/maintain/aurrepo/pkglist
+ - user: root
+ - group: root
+ - mode: 644
+ - makedirs: true
+ - template: jinja
+
+"/usr/lib/systemd/system/updateaur.service":
+ file.managed:
+ - source: salt://roles/maintain/aurrepo/updateaur.service
+ - user: root
+ - group: root
+ - mode: 644
+
+"/usr/lib/systemd/system/updateaur.timer":
+ file.managed:
+ - source: salt://roles/maintain/aurrepo/updateaur.timer
+ - user: root
+ - group: root
+ - mode: 644
+
+"updateaur.timer":
+ service.running:
+ - enable: true
diff --git a/states/roles/maintain/aurrepo/pkglist b/states/roles/maintain/aurblobs/pkglist
similarity index 100%
rename from states/roles/maintain/aurrepo/pkglist
rename to states/roles/maintain/aurblobs/pkglist
diff --git a/states/roles/maintain/aurrepo/updateaur.service b/states/roles/maintain/aurblobs/updateaur.service
similarity index 100%
rename from states/roles/maintain/aurrepo/updateaur.service
rename to states/roles/maintain/aurblobs/updateaur.service
diff --git a/states/roles/maintain/aurrepo/updateaur.timer b/states/roles/maintain/aurblobs/updateaur.timer
similarity index 100%
rename from states/roles/maintain/aurrepo/updateaur.timer
rename to states/roles/maintain/aurblobs/updateaur.timer
diff --git a/states/roles/maintain/podfox/init.sls b/states/roles/maintain/podfox/init.sls
new file mode 100644
index 0000000..ff6885b
--- /dev/null
+++ b/states/roles/maintain/podfox/init.sls
@@ -0,0 +1,44 @@
+python-pip:
+ pkg.installed
+
+podfox:
+ pip.installed:
+ - require:
+ - pkg: python-pip
+
+/opt/scripts/run_podfox.sh:
+ file.managed:
+ - source: salt://roles/maintain/podfox/run_podfox.sh
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
+
+/etc/systemd/system/run_podfox.service:
+ file.managed:
+ - source: salt://roles/maintain/podfox/run_podfox.service
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
+
+/etc/systemd/system/run_podfox.timer:
+ file.managed:
+ - source: salt://roles/maintain/podfox/run_podfox.timer
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
+
+run_podfox_timer:
+ service.running:
+ - name: run_podfox.timer
+ - enable: true
+
+/root/.podfox.json:
+ file.managed:
+ - source: salt://roles/maintain/podfox/podfox.json
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
\ No newline at end of file
diff --git a/states/roles/maintain/podfox/podfox.json b/states/roles/maintain/podfox/podfox.json
new file mode 100644
index 0000000..041c41b
--- /dev/null
+++ b/states/roles/maintain/podfox/podfox.json
@@ -0,0 +1,4 @@
+{
+ "podcast-directory" : "/mnt/video/Unorganized_Podcasts",
+ "maxnum" : 5
+}
diff --git a/states/roles/maintain/podfox/run_podfox.service b/states/roles/maintain/podfox/run_podfox.service
new file mode 100644
index 0000000..db80988
--- /dev/null
+++ b/states/roles/maintain/podfox/run_podfox.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=rTorrent
+
+[Service]
+User=root
+Type=simple
+KillMode=none
+ExecStart=/bin/bash /opt/scripts/run_podfox.sh
+
+[Install]
+WantedBy=default.target
\ No newline at end of file
diff --git a/states/roles/maintain/podfox/run_podfox.sh b/states/roles/maintain/podfox/run_podfox.sh
new file mode 100644
index 0000000..ce0044f
--- /dev/null
+++ b/states/roles/maintain/podfox/run_podfox.sh
@@ -0,0 +1,2 @@
+podfox update
+podfox download
diff --git a/states/roles/maintain/podfox/run_podfox.timer b/states/roles/maintain/podfox/run_podfox.timer
new file mode 100644
index 0000000..cb6fd9a
--- /dev/null
+++ b/states/roles/maintain/podfox/run_podfox.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Run podfox update and download every 30 minutes
+
+[Timer]
+OnBootSec=5min
+OnUnitActiveSec=30min
+
+Unit=run_podfox.service
+
+[Install]
+WantedBy=timers.target
diff --git a/states/roles/maintain/transmission/init.sls b/states/roles/maintain/transmission/init.sls
new file mode 100644
index 0000000..92f411e
--- /dev/null
+++ b/states/roles/maintain/transmission/init.sls
@@ -0,0 +1,42 @@
+transmission-pkg:
+ pkg.installed:
+ - name: transmission-cli
+
+transmission-settings:
+ file.symlink:
+ - name: /var/lib/transmission/.config/transmission-daemon/settings.json
+ - target: /mnt/video/transmission/settings.json
+ - force: true
+
+transmission-service:
+ service.running:
+ - name: transmission
+ - enable: true
+
+/opt/scripts/restart_transmission.sh:
+ file.managed:
+ - source: salt://roles/maintain/transmission/restart_transmission.sh
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
+
+/etc/systemd/system/restart_transmission.service:
+ file.managed:
+ - source: salt://roles/maintain/transmission/restart_transmission.service
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
+
+/etc/systemd/system/restart_transmission.timer:
+ file.managed:
+ - source: salt://roles/maintain/transmission/restart_transmission.timer
+ - user: root
+ - group: root
+ - mode: 644
+ - mkdirs: true
+transmission_timer:
+ service.running:
+ - name: restart_transmission.timer
+ - enable: true
diff --git a/states/roles/maintain/transmission/restart_transmission.service b/states/roles/maintain/transmission/restart_transmission.service
new file mode 100644
index 0000000..43043c8
--- /dev/null
+++ b/states/roles/maintain/transmission/restart_transmission.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=rTorrent
+
+[Service]
+User=root
+Type=simple
+KillMode=none
+ExecStart=/bin/bash /opt/scripts/rtorrent.sh
+
+[Install]
+WantedBy=default.target
\ No newline at end of file
diff --git a/states/roles/maintain/transmission/restart_transmission.sh b/states/roles/maintain/transmission/restart_transmission.sh
new file mode 100644
index 0000000..5f84013
--- /dev/null
+++ b/states/roles/maintain/transmission/restart_transmission.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#resurrect rtorrent when it dies and restart every 6 hours
+hour=`date | grep -Po "\d\d:\d\d:\d\d" | grep -Po "^\d\d:\d\d"`
+
+if [ "$hour" = "00:00" ] || [ "$hour" = "06:00" ] || [ "$hour" = "12:00" ] || [ "$hour" = "18:00" ];then
+ windscribe disconnect
+ windscribe connect
+ systemctl restart transmission.service
+fi
+
+currentip=`ps aux | grep rtorrent | grep -v "SCREEN" | grep -Po "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"`
+tunip=`ip addr show tun0 | grep -Po "inet \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | grep -Po "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"`
+
+if [ "$currentip" = "$tunip" ];then
+ echo "transmission is up"
+else
+ echo "restarting transmission"
+ windscribe disconnect
+ windscribe connect
+ systemctl restart transmission.service
+fi
diff --git a/states/roles/maintain/transmission/restart_transmission.timer b/states/roles/maintain/transmission/restart_transmission.timer
new file mode 100644
index 0000000..a04e5dd
--- /dev/null
+++ b/states/roles/maintain/transmission/restart_transmission.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Verify that rtorrent is running
+
+[Timer]
+OnBootSec=2min
+OnUnitActiveSec=1min
+
+Unit=restart_transmission.service
+
+[Install]
+WantedBy=timers.target
diff --git a/states/roles/maintain/windscribe/init.sls b/states/roles/maintain/windscribe/init.sls
index 3fb1e31..b711592 100644
--- a/states/roles/maintain/windscribe/init.sls
+++ b/states/roles/maintain/windscribe/init.sls
@@ -1,42 +1,5 @@
-#windscribe:
-# service.running:
-# - enable: true
-
-windscribe-vpn-pkg:
+windscribe:
pkg.installed:
- - name: openvpn
-
-#/etc/firewalld/direct.xml:
-# file.managed:
-# - source: salt://roles/maintain/windscribe/firewalld-direct.xml
-# - user: root
-# - group: root
-# - mode: 644
-
-/etc/openvpn/client/windscribe-denmark.conf:
- file.managed:
- - source: salt://roles/maintain/windscribe/windscribe-denmark.conf
- - user: root
- - group: root
- - mode: 644
-
-/etc/openvpn/client/windscribe.login:
- file.managed:
- - source: salt://secure/files/windscribe.login
- - user: root
- - group: root
- - mode: 600
-
-openvpn-client@windscribe-denmark:
+ - name: windscribe-cli
service.running:
- enable: true
- - watch:
- - file: /etc/openvpn/client/windscribe-denmark.conf
- - file: /etc/openvpn/client/windscribe.login
-
-#windscribe-firewall:
-# service.running:
-# - name: firewalld
-# - enable: true
-# - watch:
-# - file: /etc/firewalld/direct.xml
\ No newline at end of file
diff --git a/states/roles/maintain/windscribe/windscribe-denmark.conf b/states/roles/maintain/windscribe/windscribe-denmark.conf
deleted file mode 100644
index d1691a5..0000000
--- a/states/roles/maintain/windscribe/windscribe-denmark.conf
+++ /dev/null
@@ -1,78 +0,0 @@
-client
-dev tun
-proto udp
-remote dk.windscribe.com 1194
-
-nobind
-auth-user-pass windscribe.login
-
-resolv-retry infinite
-
-auth SHA512
-cipher AES-256-CBC
-keysize 256
-comp-lzo
-verb 2
-mute-replay-warnings
-remote-cert-tls server
-persist-key
-persist-tun
-
-key-direction 1
-
------BEGIN CERTIFICATE-----
-MIIF3DCCA8SgAwIBAgIJAMsOivWTmu9fMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNV
-BAYTAkNBMQswCQYDVQQIDAJPTjEQMA4GA1UEBwwHVG9yb250bzEbMBkGA1UECgwS
-V2luZHNjcmliZSBMaW1pdGVkMRMwEQYDVQQLDApPcGVyYXRpb25zMRswGQYDVQQD
-DBJXaW5kc2NyaWJlIE5vZGUgQ0EwHhcNMTYwMzA5MDMyNjIwWhcNNDAxMDI5MDMy
-NjIwWjB7MQswCQYDVQQGEwJDQTELMAkGA1UECAwCT04xEDAOBgNVBAcMB1Rvcm9u
-dG8xGzAZBgNVBAoMEldpbmRzY3JpYmUgTGltaXRlZDETMBEGA1UECwwKT3BlcmF0
-aW9uczEbMBkGA1UEAwwSV2luZHNjcmliZSBOb2RlIENBMIICI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KBWXwIAzUu691rUD2exT
-1E+A5t+xw+gzqV8rWTMIoUaH7O1EKjN6ryGW71Khiik8/ETrP3YT32ZbS2P902iM
-Kw9rpmuS0wWhnO5k/iO/6YNA1ZMV5JG5oZvZQYEDk7enLD9HvqazofMuy/Sz/n62
-ZCDdQsnabzxl04wwv5Y3JZbV/6bOM520GgdJEoDxviY05ax2Mz05otyBzrAVjFw9
-RZt/Ls8ATifu9BusZ2ootvscdIuE3x+ZCl5lvANcFEnvgGw0qpCeASLpsfxwq1dR
-gIn7BOiTauFv4eoeFAQvCD+l+EKGWKu3M2y19DgYX94N2+Xs2bwChroaO5e4iFem
-MLMuWKZvYgnqS9OAtRSYWbNX/wliiPz7u13yj+qSWgMfu8WPYNQlMZJXuGWUvKLE
-XCUExlu7/o8D4HpsVs30E0pUdaqN0vExB1KegxPWWrmLcYnPG3knXpkC3ZBZ5P/e
-l/2eyhZRy9ydiITF8gM3L08E8aeqvzZMw2FDSmousydIzlXgeS5VuEf+lUFA2h8o
-ZYGQgrLt+ot8MbLhJlkp4Q==
------END CERTIFICATE-----
-
-
------BEGIN OpenVPN Static key V1-----
-5801926a57ac2ce27e3dfd1dd6ef8204
-2d82bd4f3f0021296f57734f6f1ea714
-a6623845541c4b0c3dea0a050fe6746c
-b66dfab14cda27e5ae09d7c155aa554f
-399fa4a863f0e8c1af787e5c602a801d
-3a2ec41e395a978d56729457fe6102d7
-d9e9119aa83643210b33c678f9d4109e
-3154ac9c759e490cb309b319cf708cae
-83ddadc3060a7a26564d1a24411cd552
-fe6620ea16b755697a4fc5e6e9d0cfc0
-c5c4a1874685429046a424c026db672e
-4c2c492898052ba59128d46200b40f88
-0027a8b6610a4d559bdc9346d33a0a6b
-08e75c7fd43192b162bfd0aef0c716b3
-1584827693f676f9a5047123466f0654
-eade34972586b31c6ce7e395f4b478cb
------END OpenVPN Static key V1-----
-
-