I am very new to ansible, i am writing a set of code where the result of a shell command goes to a Register variable, and in that variable, I need to find the keyword "happy". If the keyword is found, execute ANOTHER shell script. Shell command apparently outputs multiple different values, looks like a dictionary, it is not a straight forward string, so how do i find ONE word in the entire shell result.
My attempt:
- name: execute first task
shell: /tmp/somescript
register: myResult
- name: another shell script
shell: /tmp/anotherscript
when: "happy" in myResult.
This returns saying "condition was false", when the output DOES have happy in it per the output result.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…