# Regression using variables availabe after gathering facts when specifying environment

**URL:** <https://forum.ansible.com/t/regression-using-variables-availabe-after-gathering-facts-when-specifying-environment/28974>\
**Category:** Ansible Developer\
**Created:** [November 8, 2018, 9:31am UTC](https://forum.ansible.com/t/regression-using-variables-availabe-after-gathering-facts-when-specifying-environment/28974 "2018-11-08T09:31:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koen\_Smets](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@Koen\_Smets](https://forum.ansible.com/u/Koen_Smets)\
**Post date:** [November 8, 2018, 9:31am UTC](https://forum.ansible.com/t/regression-using-variables-availabe-after-gathering-facts-when-specifying-environment/28974/1 "2018-11-08T09:31:54Z")

</div>

Dear all,

Before upgrading to ansible-2.7.x, I was able to run the following playbook.

---

<div class="post-metadata">

**Author:** ![rbarlik](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@rbarlik](https://forum.ansible.com/u/rbarlik)\
**Post date:** [November 9, 2018, 8:22pm UTC](https://forum.ansible.com/t/regression-using-variables-availabe-after-gathering-facts-when-specifying-environment/28974/2 "2018-11-09T20:22:10Z")

</div>

This looks like a regression and should be fixed.

For a workaround, I would suggest to add an empty play that would only gather facts.

---

<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:** [November 9, 2018, 8:25pm UTC](https://forum.ansible.com/t/regression-using-variables-availabe-after-gathering-facts-when-specifying-environment/28974/3 "2018-11-09T20:25:38Z")

</div>

or just add 'default' for when fact gathering runs:

PIP\_INDEX\_URL: "{{ '[https://mirrors.aliyun.com/pypi/simple](https://mirrors.aliyun.com/pypi/simple)’ if  
(ansible\_domain|default('')).startswith('cn') else  
'[https://pypi.org/simple](https://pypi.org/simple)’ }}"
