-
-
Save pduersteler/61b2540cf16fe942c71a 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
$ salt '*' state.highstate | |
---------- | |
ID: foo-public-ssh-keys | |
Function: ssh_auth.present | |
Result: False | |
Comment: An exception occurred in this state: Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1382, in call | |
**cdata['kwargs']) | |
File "/usr/lib/python2.7/dist-packages/salt/states/ssh_auth.py", line 179, in present | |
saltenv=__env__) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/ssh.py", line 410, in set_auth_key_from_file | |
'Failed to pull key file from salt file server' | |
CommandExecutionError: Failed to pull key file from salt file server |
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
# /srv/pillar/users/init.sls | |
users: | |
foo: | |
fullname: Foo | |
shell: /bin/bash | |
groups: | |
- sudo | |
ssh_key: salt://users/files/foo.pub | |
# ^-- this lies in /srv/pillar/users/files/foo.pub | |
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
{% for user, args in pillar['users'].iteritems() %} | |
{{ user }}: | |
user.present: | |
- fullname: {{ args['fullname'] }} | |
- shell: {{ args['shell'] }} | |
{% if 'groups' in args %} | |
- groups: {{ args['groups'] }} | |
{% endif %} | |
{{ user }}-public-ssh-keys: | |
ssh_auth: | |
- present | |
- user: {{ user }} | |
- source: {{ args['ssh_key'] }} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment