Skip to content

Instantly share code, notes, and snippets.

@whytewolf
Created February 5, 2018 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whytewolf/0758ae7b7f3ae871cb30d682c72a8c6e to your computer and use it in GitHub Desktop.
Save whytewolf/0758ae7b7f3ae871cb30d682c72a8c6e to your computer and use it in GitHub Desktop.
{% load_yaml as defaults %}
state:
name: clamav
client:
pkg: clamav
pkgstate: installed
freshclam:
pkgstate: installed
configfile: /etc/freshclam.conf
logfilemaxsize: 20M
{% endload %}
## Some OS-specific data which should override the defaults
{% load_yaml as os_specific %}
RedHat:
freshclam:
pkg: clamav-update
default:
freshclam:
pkg: clamav-freshclam
{% endload %}
@edgan
Copy link

edgan commented Feb 5, 2018

{% load_yaml as defaults %}
  state:
    name: clamav
  client:
    pkg: clamav
    pkgstate: installed
  freshclam:
    pkgstate: installed
    configfile: /etc/freshclam.conf
    logfilemaxsize: 20M
{% endload %}

## Some OS-specific data which should override the defaults
{% load_yaml as os_specific %}
RedHat:
  freshclam:
    pkg: clamav-update
default:
  freshclam:
    pkg: clamav-freshclam
{% endload %}

# Merge the os-specific data with the defaults
{% set os_map_addition = salt['grains.filter_by'](os_specific, grain='os', merge=defaults) %}
# And then pull in pillar data?
{% set clamav = salt['pillar.get'](defaults.state.name, default=os_map_addition, merge=True) %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment