Last active
August 29, 2015 14:13
-
-
Save dnd/f96853b6837331113929 to your computer and use it in GitHub Desktop.
environment custom grain
This file contains hidden or 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
#!/usr/bin/env python | |
import salt.config | |
import salt.loader | |
import salt.utils | |
__opts__ = salt.config.minion_config('/etc/salt/minion') | |
envutil = salt.loader.raw_mod(__opts__, 'envutil', None) | |
def environment(): | |
fqdn = salt.utils.network.get_fqhostname() | |
host = fqdn.partition('.')[0] | |
grains = {} | |
grains['environment'] = envutil['envutil.infer_env_from_name'](host) | |
grains['whydontyouexist'] = __grains__ | |
return grains |
This file contains hidden or 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
root@dev-app1:~# salt-minion --versions-report | |
Salt: 2014.7.0-1077-g378639f | |
Python: 2.6.5 (r265:79063, Feb 27 2014, 19:43:51) | |
Jinja2: 2.7.3 | |
M2Crypto: 0.20.1 | |
msgpack-python: 0.1.9.final | |
msgpack-pure: Not Installed | |
pycrypto: 2.0.1 | |
libnacl: Not Installed | |
PyYAML: 3.09 | |
ioflo: Not Installed | |
PyZMQ: 13.0.0 | |
RAET: Not Installed | |
ZMQ: 3.2.2 | |
Mako: 1.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment