Created
December 11, 2020 17:09
-
-
Save mattiasb/a5bb33bf8caf9d7149ba29ff5f9e9273 to your computer and use it in GitHub Desktop.
Ansible some tasks don't prepend role name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# roles/storage/tasks/check.yml | |
# | |
# This ends up as "[check : Type Checking bools]" below. | |
# The storage role is removed from the task. | |
- name: "check : Type Checking mount field in storage_lvm_volumes " | |
assert: | |
that: | |
# Mandatory | |
- ('path' in item) and (item.path is string) | |
# Optional | |
- ('mode' not in item) or (item.mode is string) | |
- ('user' not in item) or | |
(item.user is string) or (item.user is number) | |
- ('group' not in item) or | |
(item.group is string) or (item.group is number) | |
msg: >- | |
Some field in the mount field in storage_lvm_volumes does not type check. | |
with_items: >- | |
{{ storage_lvm_volumes | |
| rejectattr('mount', 'undefined') | |
| map(attribute='mount') | |
| list | |
}} | |
# This ends up as "[storage : check : Type Checking bools]" below. | |
- name: "check : Type Checking bools" | |
assert: | |
that: | |
- storage_nfs_enable in [true, false] | |
- storage_cifs_enable in [true, false] | |
msg: | | |
storage_nfs_enable and storage_cifs_enable should be booleans. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TASK [check : Type Checking mount field in storage_lvm_volumes] ********** | |
ok: [machine-test.local] => (item={'path': '/'}) => changed=false | |
ansible_loop_var: item | |
item: | |
path: / | |
msg: All assertions passed | |
TASK [storage : check : Type Checking bools] ***************************** | |
ok: [machine-test.local] => changed=false | |
msg: All assertions passed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment