Skip to content

Instantly share code, notes, and snippets.

@bentwire
Created August 11, 2016 17:14
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 bentwire/eda7be0880d2d2c3f95d4d8828d94e16 to your computer and use it in GitHub Desktop.
Save bentwire/eda7be0880d2d2c3f95d4d8828d94e16 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
'''
Detect disks
'''
from __future__ import absolute_import
# Import python libs
import glob
import logging
import re
# Import salt libs
import salt.config
import salt.loader
import salt.utils
import salt.utils.network
# Solve the Chicken and egg problem where grains need to run before any
# of the modules are loaded and are generally available for any usage.
import salt.modules.cmdmod
import salt.modules.pillar
__salt__ = {
'cmd.run': salt.modules.cmdmod._run_quiet,
'pillar.get': salt.modules.pillar.get
}
log = logging.getLogger(__name__)
__opts__ = salt.config.minion_config('/etc/salt/minion')
def roles():
pillarmod = salt.loader.raw_mod(__opts__, 'pillar', None)
log.trace("Setting roles grain from pillar. ")
grains = {}
grains['roles'] = pillarmod['pillar.get']('roles')
log.trace("DONE Setting roles grain from pillar. ({})".format(grains))
return grains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment