@@ -7,7 +7,7 @@ | |||
system_group_{{ group_name }}: | |||
group.present: | |||
- name: {{ group.name }} | |||
- name: {{ group.get('name', group_name) }} | |||
{%- if group.system is defined and group.system %} | |||
- system: True | |||
{%- endif %} |
@@ -23,6 +23,10 @@ linux_job_{{ job.command }}: | |||
{%- if job.dayweek is defined %} | |||
- dayweek: '{{ job.dayweek }}' | |||
{%- endif %} | |||
{%- if job.user in system.get('user', {}).keys() %} | |||
- require: | |||
- user: system_user_{{ job.user }} | |||
{%- endif %} | |||
{%- else %} | |||
cron.absent: | |||
- name: {{ job.command }} |
@@ -5,6 +5,14 @@ | |||
{%- 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 }}: | |||
user.present: | |||
- name: {{ name }} | |||
@@ -25,6 +33,7 @@ system_user_{{ name }}: | |||
{%- if user.uid is defined and user.uid %} | |||
- uid: {{ user.uid }} | |||
{%- endif %} | |||
- require: {{ requires|yaml }} | |||
system_user_home_{{ user.home }}: | |||
file.directory: |
@@ -43,7 +43,8 @@ linux: | |||
full_name: Test User | |||
home: /home/test | |||
groups: | |||
- root | |||
- db-ops | |||
- salt-ops | |||
salt_user1: | |||
enabled: true | |||
name: saltuser1 | |||
@@ -58,18 +59,19 @@ linux: | |||
uid: 9992 | |||
full_name: Salt Sudo User2 | |||
home: /home/saltuser2 | |||
groups: | |||
- sudogroup1 | |||
group: | |||
testgroup: | |||
test: | |||
enabled: true | |||
name: test | |||
gid: 9999 | |||
system: true | |||
db-ops: | |||
enabled: true | |||
name: testgroup | |||
salt-ops: | |||
enabled: true | |||
name: sudogroup0 | |||
name: salt-ops | |||
sudogroup1: | |||
enabled: true | |||
name: sudogroup1 |