diff --git a/states/top.sls b/states/top.sls index 8d8e637..3adcde1 100644 --- a/states/top.sls +++ b/states/top.sls @@ -1,3 +1,41 @@ -dev: - '*': + +{%- set states = salt['cp.list_states'](saltenv) -%} +{%- set envs = ['prod','dev'] -%} +{% for env in envs %} +{{ env }}: + 'os_family:RedHat': + - match: grain_pcre + - repos.epel + 'os_family:Arch': + - match: grain_pcre - repos.aur + - systems.arch.mirrors + - systems.core.freeipa + '*': +{#- don't run update automatically on containers - updates will be triggered from their host -#} +{%- if pillar['grains']['roles'] is defined -%} + {%- if 'lxc_container' not in pillar['grains']['roles'] %} + - update + {%- endif -%} +{%- endif %} + - update.clean_cache + - update.update_containers + - basepkgs + - grains + - bashrc + - systems.core.firewalld + - systems.core.monitoring + - systems.core.mount + - systems.core.git + - systems.core.backup +{%- if grains['roles'] is defined -%} + {%- if grains['roles'] is not none -%} + {%- for role in grains['roles'] %} + {%- if 'roles.maintain.'+role in states %} + - roles.maintain.{{role}} + {%- endif -%} + {%- endfor -%} + {%- endif -%} +{%- endif -%} +{%- endfor %} + - systems.core.fstrim diff --git a/states/top.sls.bak b/states/top.sls.bak deleted file mode 100644 index 3adcde1..0000000 --- a/states/top.sls.bak +++ /dev/null @@ -1,41 +0,0 @@ - -{%- set states = salt['cp.list_states'](saltenv) -%} -{%- set envs = ['prod','dev'] -%} -{% for env in envs %} -{{ env }}: - 'os_family:RedHat': - - match: grain_pcre - - repos.epel - 'os_family:Arch': - - match: grain_pcre - - repos.aur - - systems.arch.mirrors - - systems.core.freeipa - '*': -{#- don't run update automatically on containers - updates will be triggered from their host -#} -{%- if pillar['grains']['roles'] is defined -%} - {%- if 'lxc_container' not in pillar['grains']['roles'] %} - - update - {%- endif -%} -{%- endif %} - - update.clean_cache - - update.update_containers - - basepkgs - - grains - - bashrc - - systems.core.firewalld - - systems.core.monitoring - - systems.core.mount - - systems.core.git - - systems.core.backup -{%- if grains['roles'] is defined -%} - {%- if grains['roles'] is not none -%} - {%- for role in grains['roles'] %} - {%- if 'roles.maintain.'+role in states %} - - roles.maintain.{{role}} - {%- endif -%} - {%- endfor -%} - {%- endif -%} -{%- endif -%} -{%- endfor %} - - systems.core.fstrim