# Problem with Conditional Imports

**URL:** <https://forum.ansible.com/t/problem-with-conditional-imports/19733>\
**Category:** Ansible Project\
**Created:** [November 11, 2015, 9:49am UTC](https://forum.ansible.com/t/problem-with-conditional-imports/19733 "2015-11-11T09:49:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.willert](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@thomas.willert](https://forum.ansible.com/u/thomas.willert)\
**Post date:** [November 11, 2015, 9:49am UTC](https://forum.ansible.com/t/problem-with-conditional-imports/19733/1 "2015-11-11T09:49:25Z")

</div>

Hello,  
I have a problem with conditional variable imports. I am trying to set a variable based on operatingsystem release. For ‘Solaris10’ I want one value and for all others I want another another value.

In this example I have two servers:

`$ ansible server1 -m setup | grep -E 'ansible_os_family|ansible_distribution_version' "ansible_distribution_version": "10", "ansible_os_family": "Solaris", $ ansible server2 -m setup | grep -E 'ansible_os_family|ansible_distribution_version' "ansible_distribution_version": "11.2", "ansible_os_family": "Solaris",`

I am trying to mimic the construct from this example: [http://docs.ansible.com/ansible/playbooks\_conditionals.html#conditional-imports](http://docs.ansible.com/ansible/playbooks_conditionals.html#conditional-imports)

`  
$ cat vars/defaults.yml

---

<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:** [November 11, 2015, 4:29pm UTC](https://forum.ansible.com/t/problem-with-conditional-imports/19733/2 "2015-11-11T16:29:29Z")

</div>

what version of ansible are you using?

---

<div class="post-metadata">

**Author:** ![thomas.willert](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@thomas.willert](https://forum.ansible.com/u/thomas.willert)\
**Post date:** [November 12, 2015, 7:23am UTC](https://forum.ansible.com/t/problem-with-conditional-imports/19733/3 "2015-11-12T07:23:27Z")

</div>

Sorry, I am using Ansible 1.9.4 on CentOS 7.1.

/ Thomas

---

<div class="post-metadata">

**Author:** ![thomas.willert](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@thomas.willert](https://forum.ansible.com/u/thomas.willert)\
**Post date:** [November 12, 2015, 2:23pm UTC](https://forum.ansible.com/t/problem-with-conditional-imports/19733/4 "2015-11-12T14:23:18Z")

</div>

I havent managed to understand my problem but I have been able to use this workaround using the “include\_vars” module instead:

`
