# Please help to reduce number of lines in tasks

**URL:** <https://forum.ansible.com/t/please-help-to-reduce-number-of-lines-in-tasks/27649>\
**Category:** Ansible Project\
**Created:** [May 28, 2018, 8:53am UTC](https://forum.ansible.com/t/please-help-to-reduce-number-of-lines-in-tasks/27649 "2018-05-28T08:53:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balaji1](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@Balaji1](https://forum.ansible.com/u/Balaji1)\
**Post date:** [May 28, 2018, 8:53am UTC](https://forum.ansible.com/t/please-help-to-reduce-number-of-lines-in-tasks/27649/1 "2018-05-28T08:53:39Z")

</div>

Hello All,

I think it could better. Basically, copy module is repeated based application and hostname the content changes  
Could you please help me to reduce the number of lines in below tasks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 30, 2018, 3:56pm UTC](https://forum.ansible.com/t/please-help-to-reduce-number-of-lines-in-tasks/27649/2 "2018-05-30T15:56:19Z")

</div>

something like this?

- name: "Ensure file copied"  
&nbsp;&nbsp;copy:  
&nbsp;&nbsp;&nbsp;&nbsp;content: "PRODUCTION-A2-A10"  
&nbsp;&nbsp;&nbsp;&nbsp;dest: "{{alter\_keystone\_path}}/appname/environment.config"  
&nbsp;&nbsp;&nbsp;&nbsp;mode: 484  
&nbsp;&nbsp;when: app\_name == "appname1" and ansible\_hostname in ("server01",  
"server06", "server10", "server14", "server17") or ansible\_hostname in  
("server02", "server03", "server04", "server05", "server07",  
"server14", "server15", "server16", "server18", "server19')
