blob: 4f42ec8ae67f3e3e8dae87656b8a46964ee2fde5 [file] [log] [blame]
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}
{%- set pkgs_groups = {
'latest': [],
'purged': [],
'removed': [],
'installed': [],
} %}
{%- for name, package in system.package.iteritems() %}
{%- if package.repo is defined or package.hold is defined or package.verify is defined %}
linux_extra_package_{{ name }}:
{%- if package.version is defined %}
{%- if package.version == 'latest' %}
pkg.latest:
{%- elif package.version == 'purged' %}
pkg.purged:
{%- elif package.version == 'removed' %}
pkg.removed:
{%- else %}
pkg.installed:
- version: {{ package.version }}
{%- endif %}
{%- else %}
pkg.installed:
{%- endif %}
- name: {{ name }}
{%- if package.repo is defined %}
- fromrepo: {{ package.repo }}
{%- endif %}
{%- if package.hold is defined %}
- hold: {{ package.hold }}
{%- endif %}
{%- if package.verify is defined %}
- skip_verify: {{ "False" if package.verify else "True" }}
{%- endif %}
{%- else %}
{%- if package.version is not defined %}
{%- do pkgs_groups['installed'].append(name) %}
{%- elif package.version in ('latest', 'purged', 'removed') %}
{%- do pkgs_groups[package.version].append(name) %}
{%- else %}
{%- do pkgs_groups['installed'].append({name: package.version}) %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- for pkgs_group, pkgs in pkgs_groups.iteritems() %}
{%- if pkgs %}
linux_extra_packages_{{ pkgs_group }}:
pkg.{{ pkgs_group }}:
- pkgs: {{ pkgs }}
{%- endif %}
{%- endfor %}
{%- endif %}