SeungJoon
(SeungJoon)
1
I want to put the numbers 1 to 10 in the {{}} variable but it fails
How to put numbers from 1 to 10 in a variable
The condition does not use with_item
playbook example :
when: ‘“{{ }} alarms currently active” in host.stdout’
debug: msg=“{{ inventory_hostname }}:Alarm is nomal”
register: result_alarm
Thank you regard
racke
(Stefan Hornburg)
2
I want to put the numbers 1 to 10 in the {{}} variable but it fails
How to put numbers from 1 to 10 in a variable
The condition does not use with_item
playbook example :
- name: Alarm check
when: '"{{ }} alarms currently active" in host.stdout'
debug: msg="{{ inventory_hostname }}:Alarm is nomal"
register: result_alarm
Thank you regard
Can you please elaborate on the objectives of the task? What are the contents of host.stdout?
Regards
Racke
SeungJoon
(SeungJoon)
3
The contents of host.stdout is this No alarms currently active
“1 alarms currently active”
“No alarms currently active”
Regards
SeungJoon
(SeungJoon)
4
The contents of host.stdout is this No alarms currently active
“1 alarms currently active”
“No alarms currently active”
If you are trying to find out if there are any alarm for this host,
then use regex search:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#testing-strings