# Template tasks based on OS version...

**URL:** <https://forum.ansible.com/t/template-tasks-based-on-os-version/35232>\
**Category:** Ansible Project\
**Created:** [May 26, 2021, 8:01pm UTC](https://forum.ansible.com/t/template-tasks-based-on-os-version/35232 "2021-05-26T20:01:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_Speagle](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@Andy\_Speagle](https://forum.ansible.com/u/Andy_Speagle)\
**Post date:** [May 26, 2021, 8:01pm UTC](https://forum.ansible.com/t/template-tasks-based-on-os-version/35232/1 "2021-05-26T20:01:16Z")

</div>

Hi Folks,

I’m busy converting some puppet modules to ansible… and I’m trying to figure out how best to lay down some files based on the host os version… I’m trying to lay down one set of files if os\_version x… another set of files if os\_version y… etc.

I don’t see how in the template or file modules to do something simple like this…

Anyone can clue me in on proper technique for this?

Thanks!

Andy

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [May 26, 2021, 8:03pm UTC](https://forum.ansible.com/t/template-tasks-based-on-os-version/35232/2 "2021-05-26T20:03:56Z")

</div>

Using ansible facts and when in the play. have done this before. Am on my phone so can send you an example later.

---

<div class="post-metadata">

**Author:** ![Andy\_Speagle](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@Andy\_Speagle](https://forum.ansible.com/u/Andy_Speagle)\
**Post date:** [May 27, 2021, 1:19am UTC](https://forum.ansible.com/t/template-tasks-based-on-os-version/35232/3 "2021-05-27T01:19:05Z")

</div>

Okay, yeah… I reasoned this out. I was making it harder than required.
