# Detecting os in conditional for local action

**URL:** <https://forum.ansible.com/t/detecting-os-in-conditional-for-local-action/18654>\
**Category:** Ansible Project\
**Created:** [July 1, 2015, 6:02pm UTC](https://forum.ansible.com/t/detecting-os-in-conditional-for-local-action/18654 "2015-07-01T18:02:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Swerlick](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Andrew\_Swerlick](https://forum.ansible.com/u/Andrew_Swerlick)\
**Post date:** [July 1, 2015, 6:02pm UTC](https://forum.ansible.com/t/detecting-os-in-conditional-for-local-action/18654/1 "2015-07-01T18:02:29Z")

</div>

Is there a way to detect what OS ansible is being run on and to use that information in the condiational for a local\_action task?

In particular, I need create a temporary directory on the local machine to fetch a local file into. I’d like to use mktemp, but it behaves differently on Mac OSX vs linux. I’d like one version of the localaction task that runs on Mac’s and another for linux.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 4, 2015, 2:29am UTC](https://forum.ansible.com/t/detecting-os-in-conditional-for-local-action/18654/2 "2015-07-04T02:29:16Z")

</div>

have a play that targets localhost and have it gather facts
