# String alignments

**URL:** <https://forum.ansible.com/t/string-alignments/31866>\
**Category:** Ansible Project\
**Created:** [December 23, 2019, 12:26pm UTC](https://forum.ansible.com/t/string-alignments/31866 "2019-12-23T12:26:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gopal\_Chatla](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@Gopal\_Chatla](https://forum.ansible.com/u/Gopal_Chatla)\
**Post date:** [December 23, 2019, 12:26pm UTC](https://forum.ansible.com/t/string-alignments/31866/1 "2019-12-23T12:26:07Z")

</div>

Hi Team,

I am redirecting debug messages output to a ‘’ Txt" file using jinja2 templating alignment( by replacing extra strings ). Basically I want to send that file contents to email but output is not looking decent.

Is there any way to include python script in ansible playbook for string alignments. Suggestions please.

Thanks,  
Gopal

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [December 23, 2019, 2:11pm UTC](https://forum.ansible.com/t/string-alignments/31866/2 "2019-12-23T14:11:03Z")

</div>

Try "Filter plugins"  
[https://docs.ansible.com/ansible/latest/dev\_guide/developing\_plugins.html#filter-plugins](https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html#filter-plugins)

Cheers,

&nbsp;&nbsp;-vlado

---

<div class="post-metadata">

**Author:** ![acozine1](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@acozine1](https://forum.ansible.com/u/acozine1)\
**Post date:** [December 23, 2019, 6:08pm UTC](https://forum.ansible.com/t/string-alignments/31866/3 "2019-12-23T18:08:34Z")

</div>

There are already several filters for text - maybe an existing one would do what you need? You can look at [https://docs.ansible.com/ansible/devel/user\_guide/playbooks\_filters.html](https://docs.ansible.com/ansible/devel/user_guide/playbooks_filters.html) for some pointers.

Hope this helps,  
Alicia

---

<div class="post-metadata">

**Author:** ![Gopal\_Chatla](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@Gopal\_Chatla](https://forum.ansible.com/u/Gopal_Chatla)\
**Post date:** [December 26, 2019, 9:51am UTC](https://forum.ansible.com/t/string-alignments/31866/4 "2019-12-26T09:51:09Z")

</div>

I’ve created a variable from stdout\_lines and the contents are copied into a file through blockinfile module along with jinja template for loop.

The for loop iterates 40 lines. But how do add new line after every 10 lines in jinja template for loop. Like a excel sheet.

Thanks, Gopal

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [December 26, 2019, 3:51pm UTC](https://forum.ansible.com/t/string-alignments/31866/5 "2019-12-26T15:51:57Z")

</div>

> I've created a variable from stdout\_lines and the contents are copied into a file through blockinfile module along with  
> jinja template for loop.
> 
> The for loop iterates 40 lines. But how do add new line after every 10 lines in jinja template for loop. Like a excel  
> sheet.
> 
> Thanks, Gopal

Please elaborate on what is your real objective. Without any further information it seems quite futile to me to guess  
your problem.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Gopal\_Chatla](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@Gopal\_Chatla](https://forum.ansible.com/u/Gopal_Chatla)\
**Post date:** [December 27, 2019, 9:57am UTC](https://forum.ansible.com/t/string-alignments/31866/6 "2019-12-27T09:57:47Z")

</div>

I am using jinja2 expressions to iterate a 40 lines list. Basically my objective is, how do I iterate first 10 lines In first column and there after another 10 lines in second column?

Thanks,  
Gopal

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [December 27, 2019, 10:03am UTC](https://forum.ansible.com/t/string-alignments/31866/7 "2019-12-27T10:03:01Z")

</div>

> I am using jinja2 expressions to iterate a 40 lines list. Basically my objective is, how do I iterate first 10 lines In  
> first column and there after another 10 lines in second column?
> 
> Thanks,  
> Gopal

Do you mind to share your playbook / tasks and a sample for the list?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
