# Curator environment variables for hosts

**URL:** <https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513>\
**Category:** Elasticsearch\
**Created:** [April 10, 2018, 3:42pm UTC](https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513 "2018-04-10T15:42:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![treyd](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@treyd](https://discuss.elastic.co/u/treyd)\
**Post date:** [April 10, 2018, 3:42pm UTC](https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513/1 "2018-04-10T15:42:22Z")

</div>

How can I specify a list of hosts for curator's config file using an environment variable? I have the following in my curator-config.yml:

client:  
hosts: ${ELASTICSEARCH\_HOSTS:127.0.0.1}

When I try something like:

$ ELASTICSEARCH\_HOST=192.168.202.77,192.168.202.78,192.168.202.79 curator --config curator-config.yml

It times out. The debug output says that hosts gets set to one value in a list instead of three values, which seems wrong:

2018-04-10 15:40:18,700 DEBUG curator.utils get\_client:803 kwargs = {'url\_prefix': '', 'aws\_secret\_key': None, 'http\_auth': None, 'certificate': None, 'aws\_key': None, 'aws\_sign\_request': False, 'port': 9200, 'hosts': ['192.168.202.77, 192.168.202.78, 192.168.202.79'], 'timeout': 30, 'aws\_token': None, 'use\_ssl': False, 'master\_only': False, 'client\_cert': None, 'ssl\_no\_validate': False, 'client\_key': None}

Is there a way to properly expand an environment variable into a list?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [April 10, 2018, 3:55pm UTC](https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513/2 "2018-04-10T15:55:31Z")

</div>

No, there is not. Your better bet is to have a single IP that points to a load balancing IP, or to deploy to _all_ of your master eligible nodes, and set `master_only: true` in the `client` block. It will then only execute on the _elected_ master node, and just exit without doing anything on the other nodes.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [April 10, 2018, 3:58pm UTC](https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513/3 "2018-04-10T15:58:03Z")

</div>

On a _very_ odd chance this might work, you could have 3 environment variables:

```auto
client:
  hosts:
    - ${HOST1:127.0.0.1}
    - ${HOST2:127.0.0.1}
    - ${HOST3:127.0.0.1}

```

I've never tried this, but I can't imagine why this approach wouldn't work.

---

<div class="post-metadata">

**Author:** ![treyd](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@treyd](https://discuss.elastic.co/u/treyd)\
**Post date:** [April 10, 2018, 4:47pm UTC](https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513/4 "2018-04-10T16:47:48Z")

</div>

Thanks, pointing at a single IP is the strategy I settled on. I'm deploying curator in a docker container, and the de facto way of providing config to a container is via env vars (a la the official Elasticsearch containers)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 8, 2018, 4:48pm UTC](https://discuss.elastic.co/t/curator-environment-variables-for-hosts/127513/5 "2018-05-08T16:48:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
