Skip to content

Instantly share code, notes, and snippets.

@mgwilliams
Created October 18, 2013 17:08
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 mgwilliams/9b48ba2bc5f5f6292de0 to your computer and use it in GitHub Desktop.
Save mgwilliams/9b48ba2bc5f5f6292de0 to your computer and use it in GitHub Desktop.
#!py
def run():
"""
Manages users defined in pillar.
"""
hsd = {}
environment = 'sandbox' if __grains__.get('environment') == 'sandbox' \
else 'production'
users = __pillar__.get('users', {})
valid_groups = set(__pillar__.get('groups', {}).keys())
sudo_groups = set(['admin']).union(__pillar__.get('sudo-groups', []))
unpriviledged_groups = set(__pillar__.get('user-groups', []))
@mgwilliams
Copy link
Author

    Data failed to compile:
----------
    Rendering SLS users failed, render error: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/salt/utils/templates.py", line 210, in py
    data = mod.run()
  File "/var/cache/salt/minion/files/base/users/init.sls", line 9, in run
    environment = 'sandbox' if __grains__.get('environment') == 'sandbox' \
NameError: global name '__grains__' is not defined

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