Created
August 11, 2016 17:14
-
-
Save bentwire/eda7be0880d2d2c3f95d4d8828d94e16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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