Assert variables.

This commit is contained in:
Robert de Bock 2020-06-26 13:00:27 +02:00
parent 7a4d42175b
commit a4274a999f
2 changed files with 28 additions and 0 deletions

25
tasks/assert.yml Normal file
View file

@ -0,0 +1,25 @@
---
- name: test if grub_timeout is set correctly
assert:
that:
- grub_timeout is defined
- grub_timeout | int >= 0
- name: test if grub_options is set correctly
assert:
that:
- grub_options | length > 0
- grub_options is iterable
when:
- grub_options is defined
- name: test if item in grub_options is set correctly
assert:
that:
- item.option is defined
- item.option | length > 0
- item.value is defined
- item.value | length > 0
loop: "{{ grub_options }}"
when:
- grub_options is defined

View file

@ -1,5 +1,8 @@
---
# tasks file for grub
- name: include assert.yml
include_tasks: assert.yml
- name: install required packages
package:
name: "{{ grub_packages }}"