Change-Id: I9767e07ffe3a808ee9a2de925862ba193b7b612eusers_deps
system_group_{{ group_name }}: | system_group_{{ group_name }}: | ||||
group.present: | group.present: | ||||
- name: {{ group.name }} | |||||
- name: {{ group.get('name', group_name) }} | |||||
{%- if group.system is defined and group.system %} | {%- if group.system is defined and group.system %} | ||||
- system: True | - system: True | ||||
{%- endif %} | {%- endif %} |
{%- if job.dayweek is defined %} | {%- if job.dayweek is defined %} | ||||
- dayweek: '{{ job.dayweek }}' | - dayweek: '{{ job.dayweek }}' | ||||
{%- endif %} | {%- endif %} | ||||
{%- if job.user in system.get('user', {}).keys() %} | |||||
- require: | |||||
- user: system_user_{{ job.user }} | |||||
{%- endif %} | |||||
{%- else %} | {%- else %} | ||||
cron.absent: | cron.absent: | ||||
- name: {{ job.command }} | - name: {{ job.command }} |
{%- if user.enabled %} | {%- if user.enabled %} | ||||
{%- set requires = [] %} | |||||
{%- for group in user.get('groups', []) %} | |||||
{%- if group in system.get('group', {}).keys() %} | |||||
{%- do requires.append({'group': 'system_group_'+group}) %} | |||||
{%- endif %} | |||||
{%- endfor %} | |||||
system_user_{{ name }}: | system_user_{{ name }}: | ||||
user.present: | user.present: | ||||
- name: {{ name }} | - name: {{ name }} | ||||
{%- if user.uid is defined and user.uid %} | {%- if user.uid is defined and user.uid %} | ||||
- uid: {{ user.uid }} | - uid: {{ user.uid }} | ||||
{%- endif %} | {%- endif %} | ||||
- require: {{ requires|yaml }} | |||||
system_user_home_{{ user.home }}: | system_user_home_{{ user.home }}: | ||||
file.directory: | file.directory: |
full_name: Test User | full_name: Test User | ||||
home: /home/test | home: /home/test | ||||
groups: | groups: | ||||
- root | |||||
- db-ops | |||||
- salt-ops | |||||
salt_user1: | salt_user1: | ||||
enabled: true | enabled: true | ||||
name: saltuser1 | name: saltuser1 | ||||
uid: 9992 | uid: 9992 | ||||
full_name: Salt Sudo User2 | full_name: Salt Sudo User2 | ||||
home: /home/saltuser2 | home: /home/saltuser2 | ||||
groups: | |||||
- sudogroup1 | |||||
group: | group: | ||||
testgroup: | |||||
test: | |||||
enabled: true | enabled: true | ||||
name: test | name: test | ||||
gid: 9999 | gid: 9999 | ||||
system: true | system: true | ||||
db-ops: | db-ops: | ||||
enabled: true | enabled: true | ||||
name: testgroup | |||||
salt-ops: | salt-ops: | ||||
enabled: true | enabled: true | ||||
name: sudogroup0 | |||||
name: salt-ops | |||||
sudogroup1: | sudogroup1: | ||||
enabled: true | enabled: true | ||||
name: sudogroup1 | name: sudogroup1 |