Loop to Print same name multiple times

11 views
Skip to first unread message

R.B. Kumar

unread,
May 30, 2021, 12:52:42 PM5/30/21
to Ansible Project
Hello Everyone - I am aware we can use with_items and loop methods to create a iterative loops in Ansible. Is there a logic to use kind of "for loops"

For example, i want to execute one Cisco command in the same Router continuously for 10 times .. How to do this in Ansible? i am looking some thing like " range" command in python 

Currently i use hard way of manually entering the command  multiple times

- name: clear session
  ios_commands:
    commands:
        - clear counters
        - clear counters
        - clear counters
        - clear counters

regards,RB

vinoth kumar

unread,
May 30, 2021, 12:59:48 PM5/30/21
to ansible...@googlegroups.com
Hi 
There is sequence and count loops . Look at here 


--
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/49ff0af7-f164-4ce7-bc80-202afc51725an%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages