# Loop to Print same name multiple times

**URL:** <https://forum.ansible.com/t/loop-to-print-same-name-multiple-times/35254>\
**Category:** Ansible Project\
**Created:** [May 30, 2021, 4:52pm UTC](https://forum.ansible.com/t/loop-to-print-same-name-multiple-times/35254 "2021-05-30T16:52:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![R.B\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@R.B\_Kumar](https://forum.ansible.com/u/R.B_Kumar)\
**Post date:** [May 30, 2021, 4:52pm UTC](https://forum.ansible.com/t/loop-to-print-same-name-multiple-times/35254/1 "2021-05-30T16:52:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vinod93pop](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@vinod93pop](https://forum.ansible.com/u/vinod93pop)\
**Post date:** [May 30, 2021, 4:59pm UTC](https://forum.ansible.com/t/loop-to-print-same-name-multiple-times/35254/2 "2021-05-30T16:59:23Z")

</div>

Hi  
There is sequence and count loops . Look at here

[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_loops.html#with-sequence](https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-sequence)

//Vinoth
