# How to specify ANSIBLE\_CONSUL\_URL for consul\_kv lookup?

**URL:** <https://forum.ansible.com/t/how-to-specify-ansible-consul-url-for-consul-kv-lookup/21806>\
**Category:** Ansible Project\
**Created:** [June 18, 2016, 1:57am UTC](https://forum.ansible.com/t/how-to-specify-ansible-consul-url-for-consul-kv-lookup/21806 "2016-06-18T01:57:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [June 18, 2016, 1:57am UTC](https://forum.ansible.com/t/how-to-specify-ansible-consul-url-for-consul-kv-lookup/21806/1 "2016-06-18T01:57:17Z")

</div>

This plugin uses os.environ[‘ANSIBLE\_CONSUL\_URL’] to get the consul url, defaulting to [http://localhost:8500](http://localhost:8500) if not set. This works fine when run on the host node where consul is running.

How would I set a dynamically environment set a host env when this lookup is running local?

I have hacked the source to allow for getting host and port from params, eg:

consul\_api = consul.Consul(host=params[‘consul\_host’], port=params[‘consul\_port’])

I am happy to provide a PR for this, but would for sure like to get rid of my local copy.
