{% set package_names = salt['grains.filter_by']({ 'Debian': {'docker': 'docker.io', 'python_docker': 'python3-docker'}, 'Suse': {'docker': 'docker', 'python_docker': 'python311-docker'}, 'RedHat': {'docker': 'docker', 'python_docker': 'python3-docker'} }, default='Debian') %} docker installed: pkg.installed: - name: {{ package_names.docker }} python docker installed: pkg.installed: - name: {{ package_names.python_docker }} {% if grains.os_family in ["Suse", "Debian"] %} apparmor-utils installed: pkg.installed: - name: apparmor-utils {% endif %} docker service running: service.running: - name: docker