Skip to content

Instantly share code, notes, and snippets.

@GreyGnome
Last active August 29, 2015 14:19
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 GreyGnome/55697d74a5418f71141d to your computer and use it in GitHub Desktop.
Save GreyGnome/55697d74a5418f71141d to your computer and use it in GitHub Desktop.
...
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/system/base/users/init.sls:
# See http://serverfault.com/questions/538218/deploy-ssh-key-from-master-to-minion-via-salt-pillars
add_root:
user.present:
- name: 0
# vim : set ft=yaml tabstop=2 sts=2 sw=2 et ai si
[DEBUG ] Results of YAML rendering:
OrderedDict([('add_root', OrderedDict([('user.present', [OrderedDict([('name', 0)])])]))])
[INFO ] Running state [add_root] at time 17:32:44.181095
[INFO ] Executing state user.present for add_root
[INFO ] User add_root set to be added
[INFO ] Completed state [add_root] at time 17:32:44.186033
[DEBUG ] LazyLoaded .returner
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
local:
----------
ID: add_root
Function: user.present
Result: None
Comment: User add_root set to be added
Started: 17:32:44.181095
Duration: 4.938 ms
Changes:
Summary
------------
Succeeded: 1 (unchanged=1)
Failed: 0
------------
Total states run: 1
=====================================================================================================
Successful output when test.succeed_without_changes: is in it:
myminion:
----------
ID: add_root
Function: test.succeed_without_changes
Result: True
Comment: If we weren't testing, this would be a success!
Started: 17:13:20.016763
Duration: 0.471 ms
Changes:
/srv/salt/system/base/users/init.sls:
--------------------------------------------------------------------------------
# See http://serverfault.com/questions/538218/deploy-ssh-key-from-master-to-minion-via-salt-pillars
{% for user in pillar['users'] %}
add_{{user}}:
user.present:
- name: {{user.name}}
{% endfor %}
# vim : set ft=yaml tabstop=2 sts=2 sw=2 et ai si
--------------------------------------------------------------------------------
(root)# salt-call pillar.get users
local:
----------
users:
----------
root:
----------
name:
root
sshpub:
ssh-dss <long key here>
uid:
0
(root)# salt-call -l debug state.highstate test=True
local:
Data failed to compile:
----------
ID user.uid in SLS system/base.users is not a dictionary
# cat /srv/salt/top.sls
base:
'*':
- system/base
(root)# ls -R /srv/salt
/srv/salt:
system top.sls
/srv/salt/system:
base
/srv/salt/system/base:
init.sls users
/srv/salt/system/base/users:
init.sls
(root)# cat /srv/salt/system/base/init.sls
{% set system_type = salt['grains.get']('system', '') %}
include:
- .users
(root)# cat /srv/salt/system/base/users/init.sls
# See http://serverfault.com/questions/538218/deploy-ssh-key-from-master-to-minion-via-salt-pillars
{% for user in pillar['users'] %}
user.uid:
- uid: {{user}}
{% endfor %}
# vim : set ft=yaml tabstop=2 sts=2 sw=2 et ai si
(root)# cat /srv/pillar/top.sls
base:
'*':
- users
(root)# cat /srv/pillar/users/init.sls
users:
root:
name: root
uid: 0
sshpub: ssh-dss AAAA<rest of long public key here...>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment