Last active
August 29, 2015 14:21
-
-
Save nledez/2bfc2025c63fb5caad6b to your computer and use it in GitHub Desktop.
_module/pushsshkey.py
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
import salt.loader | |
def get_user_key(username): | |
__states__ = salt.loader.states(__opts__, __salt__) | |
out = '' | |
for key in __pillar__.get('ssh_keys', {}).get(username, {}).get('ssh_auth', []): | |
__states__['ssh_auth.present'](key, 'root') | |
out += '{}\n'.format(key) | |
return out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
root@salt:/srv/salt/_modules# salt cozy-nico pushsshkey.get_user_key nico
cozy-nico: