Passing environment variable set in group_vars to lookup pluging

15 views
Skip to first unread message

Samnang Sen

unread,
Mar 16, 2016, 3:37:32 PM3/16/16
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages