Added radarr and restore states
This commit is contained in:
parent
51a7806ef3
commit
aa106b5d52
19 changed files with 96 additions and 4 deletions
21
pillars/roles/backup/init.sls
Normal file
21
pillars/roles/backup/init.sls
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% set states = salt['cp.list_states'](saltenv) %}
|
||||
include:
|
||||
- roles.backup.none
|
||||
{%- if grains['roles'] is defined -%}
|
||||
{%- if grains['roles'] is not none -%}
|
||||
{%- if 'portal' in grains['roles'] -%}
|
||||
{%- for state in states %}
|
||||
{%- if state.startswith("pillars.roles.backup.") -%}
|
||||
{%- set role = state.split('.')[3] %}
|
||||
- roles.backup.{{ role }}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
{%- for role in grains['roles'] %}
|
||||
{%- if 'pillars.roles.backup.'+role in states %}
|
||||
- roles.backup.{{ role }}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
0
pillars/roles/backup/none.sls
Executable file
0
pillars/roles/backup/none.sls
Executable file
9
pillars/roles/backup/radarr.sls
Normal file
9
pillars/roles/backup/radarr.sls
Normal file
|
@ -0,0 +1,9 @@
|
|||
backup:
|
||||
radarr:
|
||||
location: /var/lib/radarr
|
||||
user: radarr
|
||||
group: radarr
|
||||
fmode: 644
|
||||
dmode: 755
|
||||
services:
|
||||
- radarr
|
|
@ -5,3 +5,4 @@ include:
|
|||
- roles.aurpkgs
|
||||
- roles.mount
|
||||
- roles.git
|
||||
- roles.backup
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
mount:
|
||||
sshfs:
|
||||
/mnt:
|
||||
/srv/salt:
|
||||
host: host.actcur.com
|
||||
directory: /mnt/butter/salt
|
||||
user: mount
|
||||
user: salt
|
||||
/mnt/backups:
|
||||
host: host.actcur.com
|
||||
directory: /mnt/butter/backups/configurations
|
||||
user: backups
|
||||
|
|
1
states/backups
Symbolic link
1
states/backups
Symbolic link
|
@ -0,0 +1 @@
|
|||
/mnt/backups
|
|
@ -1 +0,0 @@
|
|||
/root/scripts/mirrors.jinja
|
1
states/mirrors.jinja
Symbolic link
1
states/mirrors.jinja
Symbolic link
|
@ -0,0 +1 @@
|
|||
/root/scripts/mirrors.jinja
|
|
@ -1 +0,0 @@
|
|||
/root/scripts/mirrors.list
|
1
states/mirrors.list
Symbolic link
1
states/mirrors.list
Symbolic link
|
@ -0,0 +1 @@
|
|||
/root/scripts/mirrors.list
|
|
@ -1 +0,0 @@
|
|||
../pillars/
|
1
states/pillars
Symbolic link
1
states/pillars
Symbolic link
|
@ -0,0 +1 @@
|
|||
../pillars/
|
38
states/restore/init.sls
Normal file
38
states/restore/init.sls
Normal file
|
@ -0,0 +1,38 @@
|
|||
{##ensure that backup pillar exists##}
|
||||
{%- if pillar['backup'] is defined -%}
|
||||
|
||||
{##restore directories from backup##}
|
||||
{%- for name in pillar['backup'] %}
|
||||
{%- if pillar['backup'][name]['location'] is defined %}
|
||||
#handle restoring radarr backup folder
|
||||
{{ pillar['backup'][name]['location'] }}:
|
||||
file.recurse:
|
||||
- source: salt://backups/{{ name }}/latest
|
||||
{%- if pillar['backup'][name]['user'] is defined %}
|
||||
- user: {{ pillar['backup'][name]['user'] }}
|
||||
{%- endif -%}
|
||||
{%- if pillar['backup'][name]['group'] is defined %}
|
||||
- group: {{ pillar['backup'][name]['group'] }}
|
||||
{%- endif -%}
|
||||
{%- if pillar['backup'][name]['fmode'] is defined %}
|
||||
- file_mode: {{ pillar['backup'][name]['fmode'] }}
|
||||
{%- endif -%}
|
||||
{%- if pillar['backup'][name]['dmode'] is defined %}
|
||||
- dir_mode: {{ pillar['backup'][name]['dmode'] }}
|
||||
{%- endif %}
|
||||
- clean: true
|
||||
- include_empty: true
|
||||
- keep_symlinks: true
|
||||
- force_symlinks: true
|
||||
|
||||
{%- if pillar['backup'][name]['services'] is defined %}
|
||||
{%- for service in pillar['backup'][name]['services'] %}
|
||||
{{ service }}:
|
||||
service.running:
|
||||
- watch:
|
||||
- file: {{ pillar['backup'][name]['location'] }}
|
||||
{%- endfor %}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
|
@ -1 +0,0 @@
|
|||
/etc/letsencrypt/live/
|
1
states/roles/maintain/glances/certs
Symbolic link
1
states/roles/maintain/glances/certs
Symbolic link
|
@ -0,0 +1 @@
|
|||
/etc/letsencrypt/live/
|
|
@ -1 +0,0 @@
|
|||
/etc/letsencrypt/live/
|
1
states/roles/maintain/ldap/certs
Symbolic link
1
states/roles/maintain/ldap/certs
Symbolic link
|
@ -0,0 +1 @@
|
|||
/etc/letsencrypt/live/
|
|
@ -1 +0,0 @@
|
|||
/etc/letsencrypt/live/
|
1
states/roles/maintain/nginx-proxy/certs
Symbolic link
1
states/roles/maintain/nginx-proxy/certs
Symbolic link
|
@ -0,0 +1 @@
|
|||
/etc/letsencrypt/live/
|
8
states/roles/maintain/radarr/init.sls
Executable file
8
states/roles/maintain/radarr/init.sls
Executable file
|
@ -0,0 +1,8 @@
|
|||
#package is in aur repo
|
||||
radarr:
|
||||
pkg.installed
|
||||
|
||||
radarr_service:
|
||||
service.running:
|
||||
- name: radarr
|
||||
- enable: true
|
|
@ -1,5 +1,5 @@
|
|||
##### Primary configuration settings #####
|
||||
##########################################
|
||||
##########################################
|
||||
# This configuration file is used to manage the behavior of the Salt Minion.
|
||||
# With the exception of the location of the Salt Master Server, values that are
|
||||
# commented out but have an empty line after the comment are defaults that need
|
||||
|
@ -348,10 +348,11 @@ master: salt.actcur.com
|
|||
# by statically setting it. Remember that the recommended way to manage
|
||||
# environments is to isolate via the top file.
|
||||
{%- set env="dev" -%}
|
||||
{%- if pillar['env'] is defined -%}
|
||||
{%- if pillar['env'] is defined -%}
|
||||
{%- set env=pillar['env'] -%}
|
||||
{%- endif %}
|
||||
environment: {{ env }}
|
||||
pillarenv: {{ env }}
|
||||
#
|
||||
# If using the local file directory, then the state top file name needs to be
|
||||
# defined, by default this is top.sls.
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/secure
|
1
states/secure
Symbolic link
1
states/secure
Symbolic link
|
@ -0,0 +1 @@
|
|||
/secure
|
|
@ -53,5 +53,14 @@ git_pkg:
|
|||
- value: {{ pillar['git'][repo]['email'] }}
|
||||
- repo: {{ pillar['git'][repo]['path'] }}
|
||||
{%- endif -%}
|
||||
|
||||
{##ensure that key is defined pillar exists##}
|
||||
{%- if pillar['git'][repo]['key'] is defined %}
|
||||
{{ repo }}_conf_key:
|
||||
git.config_set:
|
||||
- name: core.sshCommand
|
||||
- value: "ssh -i /root/.ssh/{{ pillar['git'][repo]['key'] }}"
|
||||
- repo: {{ pillar['git'][repo]['path'] }}
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/keys/git/
|
1
states/systems/core/git/keys
Symbolic link
1
states/systems/core/git/keys
Symbolic link
|
@ -0,0 +1 @@
|
|||
/keys/git/
|
|
@ -1 +0,0 @@
|
|||
/keys/mount/
|
1
states/systems/core/mount/keys
Symbolic link
1
states/systems/core/mount/keys
Symbolic link
|
@ -0,0 +1 @@
|
|||
/keys/mount/
|
Loading…
Add table
Reference in a new issue