{%- 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