Compare commits

...

3 commits

47 changed files with 286 additions and 354 deletions

View file

@ -1,6 +1,5 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion

View file

@ -1,13 +1,12 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - arr
- arr - sonarr
- sonarr - radarr
- radarr - lidarr
- lidarr - jackett
- jackett - ytdownloader
- ytdownloader - podfox
- podfox

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - atheos
- atheos - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - authelia
- authelia - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - baikal
- baikal

View file

@ -1,6 +1,5 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - laradev
- laradev - bbs
- bbs - nginx-proxy
- nginx-proxy

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - ca
- ca

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - laradev
- laradev - clark-family
- clark-family - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - nextcloud
- nextcloud - nginx-proxy
- nginx-proxy

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - emby
- emby

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - git
- git - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - gitea
- gitea - nginx-proxy
- nginx-proxy

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - backup
- backup - host
- host - host2
- host2

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - backup
- backup - host
- host - host2
- host2

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - icinga
- icinga - nginx-proxy
- nginx-proxy

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - freeipa-server
- freeipa-server

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - lxc_container
- lxc_container - jackett
- jackett

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - laradev
- laradev

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - lxc_container
- lxc_container - lidarr
- lidarr

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - ombi
- ombi

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - pass
- pass

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - pkg-cache
- pkg-cache - aurutils
- aurutils - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - portal
- portal - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - openproject
- openproject - nginx-proxy
- nginx-proxy

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - lxc_container
- lxc_container - radarr
- radarr

View file

@ -1,4 +1,3 @@
grains: roles:
roles: - router
- router - ssh
- ssh

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - windscribe
- windscribe - rtorrent
- rtorrent

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - saltmaster
- saltmaster - mirrorlist
- mirrorlist - certbot
- certbot

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - lxc_container
- lxc_container - sonarr
- sonarr - ytdownloader
- ytdownloader

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - mysql
- mysql

View file

@ -1,7 +1,6 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - sshserver
- sshserver

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - sync
- sync - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - nrpe
- nrpe - saltminion
- saltminion - nginx-proxy
- nginx-proxy - windscribe
- windscribe - transmission
- transmission

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - ttrss
- ttrss - nginx-proxy
- nginx-proxy

View file

@ -1,9 +1,8 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - lxc
- lxc - video
- video - nginx-proxy
- nginx-proxy

View file

@ -1,8 +1,7 @@
grains: roles:
roles: - server
- server - ssh
- ssh - nrpe
- nrpe - saltminion
- saltminion - vpnserver
- vpnserver - ca-cert
- ca-cert

View file

@ -1,6 +1,6 @@
{%- set branches=salt.cmd.shell('git ls-remote https://git.actcur.com/actcur/salt.git | grep -o -P "(?<=refs/heads/).*" | grep -Pv "(^temp$)|(^history$)"').split('\n') -%} {%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
{%- for branch in branches %} {%- for env in envs %}
{{branch}}: {{env}}:
'*': '*':
- roles - roles
- servers - servers

View file

@ -7,7 +7,7 @@ git reset --hard qual;
git push --force; git push --force;
#merge to master #merge to master
git checkout -B prod origin/master; git checkout -B prod origin/prod;
git merge --squash qual; git merge --squash qual;
git commit -am "$cm"; git commit -am "$cm";
git push; git push;

View file

@ -1,14 +1,12 @@
{# ensure that grains pillar exists -#} {# ensure that grains pillar exists -#}
{%- if pillar['grains'] is defined -%} {%- if pillar['roles'] is defined %}
{%- if pillar['grains']['roles'] is defined %}
set-roles: set-roles:
grains.present: grains.present:
- name: roles - name: roles
- force: true - force: true
- value: [{% for role in pillar['grains']['roles'] %}{{role}},{% endfor %}] - value: [{% for role in pillar['roles'] %}{{role}},{% endfor %}]
{% else %} {% else %}
set-roles: set-roles:
grains.absent: grains.absent:
- name: roles - name: roles
{%- endif -%}
{%- endif -%} {%- endif -%}

View file

@ -1,7 +1,7 @@
{%- set os=grains['os'] -%} {%- set os=grains['os'] -%}
{##check if server is portal##} {##check if server is portal##}
{%- if 'portal' in pillar['grains']['roles'] -%} {%- if 'portal' in pillar['roles'] -%}
{%- set portal = "portal" -%} {%- set portal = "portal" -%}
{%- endif -%} {%- endif -%}
nginx: nginx:

View file

@ -7,10 +7,8 @@ object Host "{{server}}.actcur.com" {
import "generic-host" import "generic-host"
address = "{{server}}.actcur.com" address = "{{server}}.actcur.com"
{%- if role_data['grains'] is defined %} {%- if role_data['roles'] is defined %}
{%- if role_data['grains']['roles'] is defined %} vars.roles=[{%- for role in role_data['roles'] %}"{{role}}",{%- endfor -%}""];
vars.roles=[{%- for role in role_data['grains']['roles'] %}"{{role}}",{%- endfor -%}""];
{%- endif -%}
{%- endif %} {%- endif %}
} }

View file

@ -1,7 +1,7 @@
{%- set os=grains['os'] -%} {%- set os=grains['os'] -%}
{##check if server is portal##} {##check if server is portal##}
{%- if 'portal' in pillar['grains']['roles'] -%} {%- if 'portal' in pillar['roles'] -%}
{%- set portal = "portal" -%} {%- set portal = "portal" -%}
{%- endif -%} {%- endif -%}
nginx: nginx:

View file

@ -1,3 +1,4 @@
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
##### Primary configuration settings ##### ##### Primary configuration settings #####
########################################## ##########################################
# This configuration file is used to manage the behavior of the Salt Master. # This configuration file is used to manage the behavior of the Salt Master.
@ -422,14 +423,10 @@ state_output: terse
# - /srv/salt/prod/states # - /srv/salt/prod/states
# #
file_roots: file_roots:
{%- if pillar['branches'] is defined -%} {%- for env in envs %}
{%- if pillar['branches']['saltmaster'] is defined -%} {{env}}:
{%- for branch in pillar['branches']['saltmaster'] %} - /srv/salt/{{env}}/states
{{branch}}:
- /srv/salt/{{branch}}/states
{%- endfor %} {%- endfor %}
{%- endif %}
{%- endif %}
# #
# When using multiple environments, each with their own top file, the # When using multiple environments, each with their own top file, the
@ -441,15 +438,11 @@ file_roots:
# To specify the order in which environments are merged, set the ordering # To specify the order in which environments are merged, set the ordering
# in the env_order option. Given a conflict, the last matching value will # in the env_order option. Given a conflict, the last matching value will
# win. # win.
{% if pillar['branches'] is defined -%}
{%- if pillar['branches']['saltmaster'] is defined -%}
env_order: [ env_order: [
{%- for branch in pillar['branches']['saltmaster'] -%} {%- for env in envs -%}
'{{-branch}}', '{{env}}',
{%- endfor -%} {%- endfor -%}
'null'] 'null']
{%- endif %}
{%- endif %}
# If top_file_merging_strategy is set to 'same' and an environment does not # If top_file_merging_strategy is set to 'same' and an environment does not
# contain a top file, the top file in the environment specified by default_top # contain a top file, the top file in the environment specified by default_top
@ -570,14 +563,10 @@ hash_type: sha256
# - /srv/pillar # - /srv/pillar
# #
pillar_roots: pillar_roots:
{%- if pillar['branches'] is defined -%} {%- for env in envs %}
{%- if pillar['branches']['saltmaster'] is defined -%} {{env}}:
{%- for branch in pillar['branches']['saltmaster'] %} - /srv/salt/{{env}}/pillars
{{branch}}:
- /srv/salt/{{branch}}/pillars
{%- endfor %} {%- endfor %}
{%- endif %}
{%- endif %}
# #
#ext_pillar: #ext_pillar:
# - hiera: /etc/hiera.yaml # - hiera: /etc/hiera.yaml

View file

@ -1,6 +1,6 @@
{%- if 'backup' in pillar['grains']['roles'] -%} {%- if 'backup' in pillar['roles'] -%}
{%- else -%} {%- else -%}
{##ensure that backup pillar exists##} {##ensure that backup pillar exists##}
{%- if pillar['backup'] is defined -%} {%- if pillar['backup'] is defined -%}

View file

@ -1,18 +1,5 @@
{%- set branches=salt.cmd.shell('git ls-remote https://git.actcur.com/actcur/salt.git | grep -o -P "(?<=refs/heads/).*" | grep -Pv "(^temp$)|(^history$)"').split('\n') -%} {%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
branches: {% for env in envs %}
saltmaster: {{ env }}:
{%- for branch in branches %} 'os_family:RedHat':
- {{branch}} {% endfor %}
{%- endfor %}
git:
{%- for branch in branches %}
salt_{{branch}}:
repo: "ssh://gitea@git.actcur.com:5022/actcur/salt.git"
path: "/srv/salt/{{branch}}"
branch: "{{branch}}"
key: "git_actcur"
force: {{ "True" if branch == "prod" else "false" }}
email: "actcur@actcur.com"
name: "Actaeus Curabitur"
{%- endfor %}

View file

@ -1,10 +1,7 @@
{%- set states = salt['cp.list_states'](saltenv) -%} {%- set states = salt['cp.list_states'](saltenv) -%}
{%- if pillar['branches'] is defined -%} {%- set envs=salt.cmd.shell('git ls-remote https://git.actcur.com/actcur/salt.git | grep -o -P "(?<=refs/heads/).*" | grep -Pv "(^temp$)|(^history$)"').split('\n') -%}
{%- if pillar['branches']['saltmaster'] is defined -%} {%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
{%- set envs = pillar['branches']['saltmaster'] -%}
{%- endif -%}
{%- endif -%}
{% for env in envs %} {% for env in envs %}
{{ env }}: {{ env }}:
'os_family:RedHat': 'os_family:RedHat':
@ -17,8 +14,8 @@
- systems.core.freeipa - systems.core.freeipa
'*': '*':
{#- don't run update automatically on containers - updates will be triggered from their host -#} {#- don't run update automatically on containers - updates will be triggered from their host -#}
{%- if pillar['grains']['roles'] is defined -%} {%- if pillar['roles'] is defined -%}
{%- if 'lxc_container' not in pillar['grains']['roles'] %} {%- if 'lxc_container' not in pillar['roles'] %}
- update - update
{%- endif -%} {%- endif -%}
{%- endif %} {%- endif %}
@ -32,9 +29,9 @@
- systems.core.mount - systems.core.mount
- systems.core.git - systems.core.git
- systems.core.backup - systems.core.backup
{%- if grains['roles'] is defined -%} {%- if pillar['roles'] is defined -%}
{%- if grains['roles'] is not none -%} {%- if pillar['roles'] is not none -%}
{%- for role in grains['roles'] %} {%- for role in pillar['roles'] %}
{%- if 'roles.maintain.'+role in states %} {%- if 'roles.maintain.'+role in states %}
- roles.maintain.{{role}} - roles.maintain.{{role}}
{%- endif -%} {%- endif -%}