Hello,
I am using custom module and looping through items to do “kubectl apply -f”.
- name: create rbac objects
kubectl:
manifest: “{{ item }}”
state: present
with_fileglob: “{{ CAAS.rbac_manifests_directory }}/*”
register: rbacresult
failed_when: ‘“v1beta1 is deprecated” not in rbacresult.results[0].stdout’
tags: rbac
Here it fails with,
fatal: [localhost]: FAILED! => {“msg”: “The conditional check ‘v1beta1 not in rbacresult.results[0].stdout’ failed. The error was: error while evaluating conditional (v1beta1 not in rbacresult.results[0].stdout): Unable to look up a name or access an attribute in template string ({% if v1beta1 not in rbacresult.results[0].stdout %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like ‘-’: argument of type ‘AnsibleUndefined’ is not iterable”}
It would be nice, if I could loop through complete result variable and then fail only if “not of my specific-condition”.