ansible-development-environ.../roles/users/tasks/assert.yml

201 lines
4.9 KiB
YAML

---
- name: test if users_ssh_key_directory is set correctly
ansible.builtin.assert:
that:
- users_ssh_key_directory is defined
- users_ssh_key_directory is string
quiet: yes
- name: test if users_shell is set correctly
ansible.builtin.assert:
that:
- users_shell is defined
- users_shell is string
quiet: yes
- name: test if users_cron_allow is set correctly
ansible.builtin.assert:
that:
- users_cron_allow is defined
- users_cron_allow is boolean
quiet: yes
- name: test if users_create_home is set correctly
ansible.builtin.assert:
that:
- users_create_home is defined
- users_create_home is boolean
quiet: yes
- name: test if users_group_list is set correctly
ansible.builtin.assert:
that:
- 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
ansible.builtin.assert:
that:
- item.name is defined
- item.name is string
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
ansible.builtin.assert:
that:
- item.gid is defined
- item.gid is number
- item.gid > 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
ansible.builtin.assert:
that:
- item.state is defined
- item.state is string
- 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 item.system in users_group_list is set correctly
ansible.builtin.assert:
that:
- item.system is boolean
quiet: yes
loop: "{{ users_group_list }}"
loop_control:
label: "{{ item.name }}"
when:
- users_group_list is defined
- item.system is defined
- name: test if item.name in users_user_list is set correctly
ansible.builtin.assert:
that:
- item.name is defined
- item.name is string
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
ansible.builtin.assert:
that:
- item.cron_allow is boolean
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.uid in users_user_list is set correctly
ansible.builtin.assert:
that:
- item.uid is number
- item.uid >= 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.authorized_keys in users_user_list is set correctly
ansible.builtin.assert:
that:
- 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
ansible.builtin.assert:
that:
- item.manage_ssh_key is boolean
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.update_password in users_user_list is set correctly
ansible.builtin.assert:
that:
- 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
ansible.builtin.assert:
that:
- item.expires is number
- item.expires >= -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
ansible.builtin.assert:
that:
- item.password_validity_days is number
- item.password_validity_days >= -1
quiet: yes
loop: "{{ users_user_list }}"
loop_control:
label: "{{ item.name }}"
when:
- users_user_list is defined
- item.password_validity_days is defined
- name: test if item.system in users_user_list is set correctly
ansible.builtin.assert:
that:
- item.system is boolean
quiet: yes
loop: "{{ users_user_list }}"
loop_control:
label: "{{ item.name }}"
when:
- users_user_list is defined
- item.system is defined