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

48 lines
1.1 KiB
YAML

---
- name: test if python_pip_modules is set correctly
ansible.builtin.assert:
that:
- python_pip_modules is defined
- python_pip_modules is iterable
quiet: yes
- name: test if item.name in python_pip_modules is set correctly
ansible.builtin.assert:
that:
- item.name is defined
- item.name is string
quiet: yes
loop: "{{ python_pip_modules }}"
loop_control:
label: "{{ item.name }}"
- name: test if item.state in python_pip_modules is set correctly
ansible.builtin.assert:
that:
- item.state in [ "absent", "latest", "present" ]
quiet: yes
loop: "{{ python_pip_modules }}"
loop_control:
label: "{{ item.name }}"
when:
- item.state is defined
- name: test if item.version in python_pip_modules is set correctly
ansible.builtin.assert:
that:
- item.version is string
quiet: yes
loop: "{{ python_pip_modules }}"
loop_control:
label: "{{ item.name }}"
when:
- item.version is defined
- name: test if python_pip_update is set correctly
ansible.builtin.assert:
that:
- python_pip_update is defined
- python_pip_update is boolean
quiet: yes