243 lines
5.8 KiB
YAML
243 lines
5.8 KiB
YAML
---
|
|
- name: test if users_ssh_key_directory is set correctly
|
|
assert:
|
|
that:
|
|
- users_ssh_key_directory is defined
|
|
- users_ssh_key_directory | length > 0
|
|
quiet: yes
|
|
|
|
- name: test if users_shell is set correctly
|
|
assert:
|
|
that:
|
|
- users_shell is defined
|
|
- users_shell | length > 0
|
|
quiet: yes
|
|
|
|
- name: test if users_cron_allow is set correctly
|
|
assert:
|
|
that:
|
|
- users_cron_allow is defined
|
|
- users_cron_allow | type_debug == "bool"
|
|
quiet: yes
|
|
|
|
- name: test if users_group_list is set correctly
|
|
assert:
|
|
that:
|
|
- users_group_list | length > 0
|
|
- users_group_list is iterable
|
|
quiet: yes
|
|
when:
|
|
- users_group_list is defined
|
|
|
|
- name: test if item.name in users_group_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.name is defined
|
|
- item.name | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_group_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_group_list is defined
|
|
|
|
- name: test if item.gid in users_group_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.gid is defined
|
|
- item.gid | int
|
|
- item.gid | int > 0
|
|
quiet: yes
|
|
loop: "{{ users_group_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_group_list is defined
|
|
- item.gid is defined
|
|
|
|
- name: test if item.state in users_group_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.state is defined
|
|
- item.state | length > 0
|
|
- item.state in ["absent", "present"]
|
|
quiet: yes
|
|
loop: "{{ users_group_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_group_list is defined
|
|
- item.state is defined
|
|
|
|
- name: test if users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- users_user_list | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
|
|
- name: test if item.name in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.name is defined
|
|
- item.name | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
|
|
- name: test if item.cron_allow in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.cron_allow | type_debug == "bool"
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.cron_allow is defined
|
|
|
|
- name: test if item.comment in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.comment | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.comment is defined
|
|
|
|
- name: test if item.uid in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.uid | int
|
|
- item.uid | int >= 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.uid is defined
|
|
|
|
- name: test if item.group in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.group | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.group is defined
|
|
|
|
- name: test if item.groups in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.groups | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.groups is defined
|
|
|
|
- name: test if item.sudo_options in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.sudo_options | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.sudo_options is defined
|
|
|
|
- name: test if item.authorized_keys in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.authorized_keys | length > 0
|
|
- item.authorized_keys is iterable
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.authorized_keys is defined
|
|
|
|
- name: test if item.manage_ssh_key in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.manage_ssh_key | type_debug == "bool"
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.manage_ssh_key is defined
|
|
|
|
- name: test if item.password in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.password | length > 0
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.password is defined
|
|
|
|
- name: test if item.update_password in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.update_password | length > 0
|
|
- item.update_password in ["always", "on_create"]
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.update_password is defined
|
|
|
|
- name: test if item.exipres in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.expires | int
|
|
- item.expires | int >= -1
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.expires is defined
|
|
|
|
- name: test if item.password_validity_days in users_user_list is set correctly
|
|
assert:
|
|
that:
|
|
- item.password_validity_days | int
|
|
- item.password_validity_days | int >= -1
|
|
quiet: yes
|
|
loop: "{{ users_user_list }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- users_user_list is defined
|
|
- item.password_validity_days is defined
|