Skip to content

Instantly share code, notes, and snippets.

@pduersteler
Created November 18, 2014 14:44
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 pduersteler/61b2540cf16fe942c71a to your computer and use it in GitHub Desktop.
Save pduersteler/61b2540cf16fe942c71a to your computer and use it in GitHub Desktop.
$ 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
# /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
{% 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