# Using module vs copying conf file

**URL:** <https://forum.ansible.com/t/using-module-vs-copying-conf-file/21727>\
**Category:** Ansible Project\
**Created:** [June 9, 2016, 4:04pm UTC](https://forum.ansible.com/t/using-module-vs-copying-conf-file/21727 "2016-06-09T16:04:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat\_Roy](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@Pat\_Roy](https://forum.ansible.com/u/Pat_Roy)\
**Post date:** [June 9, 2016, 4:04pm UTC](https://forum.ansible.com/t/using-module-vs-copying-conf-file/21727/1 "2016-06-09T16:04:39Z")

</div>

I’m using the sysctl module to add a bunch of parameters to the /etc/sysctl.conf but should I just keep a local copy of my updated sysctl.conf file and upload it?

It does take longer to run one sysctl command at a time with ansible vs copying the file. How do you guys do it? I guess using the module is better for 2-3 parameters but where’s the line?

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [June 10, 2016, 3:16pm UTC](https://forum.ansible.com/t/using-module-vs-copying-conf-file/21727/2 "2016-06-10T15:16:03Z")

</div>

It's a matter of taste at the end of the day - lineinfile type things  
give me a bad feeling in general,  
but then again I can't always guarantee the entire state of a file is  
something I can always track.

---

<div class="post-metadata">

**Author:** ![dch](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dch/32/7132_2.png) [@dch](https://forum.ansible.com/u/dch)\
**Post date:** [June 10, 2016, 4:42pm UTC](https://forum.ansible.com/t/using-module-vs-copying-conf-file/21727/3 "2016-06-10T16:42:47Z")

</div>

My rule of thumb is to use a template when:

- the file is largely consistent across boxes  
- minor variations like specific ntp services can be accommodated with  
variables  
- a specific handler for restarts can be neatly applied

for sysctl its a bit more complicated than this. If you have just a few  
machines you could probably keep it in a single template, but if there  
are many variations eventually it will become too slow as you noted.

A+  
Dave
