Saltstack Official Users Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
753B

  1. {% from "users/map.jinja" import users with context %}
  2. include:
  3. - users
  4. extend:
  5. {% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
  6. {%- if user == None -%}
  7. {%- set user = {} -%}
  8. {%- endif -%}
  9. {%- set home = user.get('home', "/home/%s" % name) -%}
  10. {%- if 'prime_group' in user and 'name' in user['prime_group'] %}
  11. {%- set user_group = user.prime_group.name -%}
  12. {%- else -%}
  13. {%- set user_group = name -%}
  14. {%- endif %}
  15. users_{{ name }}_user:
  16. file.managed:
  17. - name: {{ home }}/.bashrc
  18. - owner: {{ name }}
  19. - group: {{ user_group }}
  20. - mode: 644
  21. - sources:
  22. - salt://users/files/bashrc/{{ name }}/bashrc
  23. - salt://users/files/bashrc/bashrc
  24. {% endfor %}