# Passing environment variable set in group\_vars to lookup pluging

**URL:** <https://forum.ansible.com/t/passing-environment-variable-set-in-group-vars-to-lookup-pluging/20894>\
**Category:** Ansible Project\
**Created:** [March 16, 2016, 7:37pm UTC](https://forum.ansible.com/t/passing-environment-variable-set-in-group-vars-to-lookup-pluging/20894 "2016-03-16T19:37:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_S](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Sam\_S](https://forum.ansible.com/u/Sam_S)\
**Post date:** [March 16, 2016, 7:37pm UTC](https://forum.ansible.com/t/passing-environment-variable-set-in-group-vars-to-lookup-pluging/20894/1 "2016-03-16T19:37:32Z")

</div>

I export ANSIBLE\_CONSUL\_URL in order for the Consul lookup pluging to search against a remote server. I’m not able to set this environment variable within my playbook. It still defaults to localhost. Is it not possible?

# group\_vars/all

consul\_url\_env:  
ANSIBLE\_CONSUL\_URL: http://MY\_REMOTE\_IP:8500

tasks:

- name: Grab environment info from aria.conf and set a variable  
set\_fact: environment\_id=“sf”

- name: Build list of modules and its associated tag  
set\_fact: deploy\_list=“{{ item | replace(“deploys/” + environment\_id + “/”,‘’) }}-{{ lookup(‘consul\_kv’,‘deploys/’ + environment\_id + ‘/’ + item) }}”  
with\_items: “{{ modules }}”  
environment: “{{ consul\_url\_env }}”  
register: deploy\_list\_result
