I feel like I'm going around the world on this. Thanks for all your
help, btw. The issue I'm running into with home directories is
file.directory_exists and file.exists seem to be checking from /root
instead of the absolute path I'm giving it:
{% for file in salt['cp.list_master'](prefix='sshkeys') %}
{% set user = file.split('/')[1] %}
{{ user }}:
ssh_auth:
- present
- user: {{ user }}
- source: salt://{{ file }}
- onlyif:
{% set home = salt['
user.info'](user)['home'] %}
- file.directory_exists: {{ home }}
{% endfor %}
I'm getting stuff like:
[INFO ] Running state [test] at time 15:38:02.595937
[INFO ] Executing state ssh_auth.present for test
[INFO ] Executing command OrderedDict([('file.directory_exists',
'/home/NGHS/test')]) in directory '/root'
[INFO ] onlyif execution failed
[INFO ] Completed state [test] at time 15:38:02.607251
[INFO ] Running state [user] at time 15:38:02.607968
[INFO ] Executing state ssh_auth.present for user
[INFO ] Executing command OrderedDict([('file.directory_exists',
'/home/user')]) in directory '/root'
[INFO ] onlyif execution failed
[INFO ] Completed state [user] at time 15:38:02.620963
Where user and test are obviously possible accounts.