lookup homedirs
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
{% endif %}
|
||||
|
||||
{% for user, config in salt.pillar.get('users', {}).items() %}
|
||||
|
||||
{{ user }}_user:
|
||||
user.present:
|
||||
- name: {{ user }}
|
||||
@@ -23,8 +22,15 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if config.get('manage_bashrc', False) %}
|
||||
/home/{{ user }}/.bashrc:
|
||||
{% if config.get('manage_bashrc', False) %}
|
||||
{% set homedir = salt.user.info(user).get('home', None) %}
|
||||
{% if homedir is none %}
|
||||
{{ "~%s/.bashrc" | format(user) }}:
|
||||
test.fail_without_changes:
|
||||
- name: {{ "No homedir for %s - if they were created in this run, run this state again" | format(user) }}
|
||||
{% else %}
|
||||
|
||||
{{ homedir }}/.bashrc:
|
||||
file.managed:
|
||||
- source: 'salt://users/files/bashrc.jinja'
|
||||
- template: jinja
|
||||
@@ -35,7 +41,7 @@
|
||||
bashrc_user: {{ user }}
|
||||
- require:
|
||||
- user: {{ user }}_user
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user