ansible variable in number

25 views
Skip to first unread message

이승준

unread,
Mar 8, 2020, 1:54:31 AM3/8/20
to Ansible Project
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

Stefan Hornburg (Racke)

unread,
Mar 8, 2020, 3:00:58 AM3/8/20
to ansible...@googlegroups.com
Can you please elaborate on the objectives of the task? What are the contents of host.stdout?

Regards
Racke

>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7d9fd35e-7afa-4de5-9f71-d550d07bea2f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7d9fd35e-7afa-4de5-9f71-d550d07bea2f%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

이승준

unread,
Mar 8, 2020, 3:10:13 AM3/8/20
to ansible...@googlegroups.com
The contents of host.stdout is this No alarms currently active

"1 alarms currently active"
"No alarms currently active"

Regards

SeungJoon

unread,
Mar 8, 2020, 3:10:30 AM3/8/20
to Ansible Project

Dick Visser

unread,
Mar 8, 2020, 3:18:10 AM3/8/20
to ansible...@googlegroups.com
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
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CADbbCaRkxkq9HvMM0bmTbJ%3D_FYeBae21pE4XAJawqLDbZJRywg%40mail.gmail.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
Reply all
Reply to author
Forward
0 new messages