# Elasticsearch Puppet Error

**URL:** <https://discuss.elastic.co/t/elasticsearch-puppet-error/43554>\
**Category:** Elasticsearch\
**Created:** [March 4, 2016, 8:57pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554 "2016-03-04T20:57:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![net](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@net](https://discuss.elastic.co/u/net)\
**Post date:** [March 4, 2016, 8:57pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554/1 "2016-03-04T20:57:17Z")

</div>

Hi,

I'm having the following issue below. Note that I'm running puppet 3.x, I bring that up because I'm modifying a hash in the code below. I'm doing that because of time constraints, we are demoing at the end of this month. That part (line 2 below) will be updated later so please don't focus on that.

Thanks!

```auto
# This is for puppet 3.x

$es_config = hiera_hash('elasticsearch.config')
$es_config['network.host'] = "['${hostname}','_local_']"
$proxy_addr = hiera('proxy.url')
$es_rpm_url = hiera('es.rpm.url')

class { 'elasticsearch':
        package_url => $es_rpm_url,
        proxy_url => $proxy_addr,
      }->
      elasticsearch::instance { "${es_instance_name}":
        init_defaults => hiera_hash('elasticsearch.init_defaults'),
        config => $es_config
      }

————

The following gets written to /etc/elasticsearch/instancename/elasticsearch.yml:
### MANAGED BY PUPPET ###
---
discovery:
  zen:
    ping:
      multicast:
        enabled: false
elasticsearch:
  node:
    local: true
http:
  cors:
    allow-credentials: true
    allow-origin: /.*/
    enabled: true
  max_header_size: 24kb
network:
  host: ["myhost","_local_"]

node:
  name: myhost-es-01
path:
  data: /usr/share/elasticsearch/data/es-01

transport:
  host:

——————

After puppet finishing running elasticsearch will be installed correctly and it will launch the elasticsearch service correctly.
Any additional puppet run will cause the following error:

Error: Could not retrieve local facts: syntax error on line 17, col 36: ` host: ["myhost","_local_"]'
Error: Failed to apply catalog: Could not retrieve local facts: syntax error on line 17, col 36: ` host: ["myhost","_local_"]'

```

---

<div class="post-metadata">

**Author:** ![net](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@net](https://discuss.elastic.co/u/net)\
**Post date:** [March 4, 2016, 9:02pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554/2 "2016-03-04T21:02:57Z")

</div>

How can I make the elasticsearch puppet module write the network.host array like this:

'''  
network:  
host:  
- myhost  
- _local_  
'''

---

<div class="post-metadata">

**Author:** ![net](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@net](https://discuss.elastic.co/u/net)\
**Post date:** [March 4, 2016, 9:03pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554/3 "2016-03-04T21:03:36Z")

</div>

@tylerjl

---

<div class="post-metadata">

**Author:** ![tylerjl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylerjl/32/44965_2.png) [@tylerjl](https://discuss.elastic.co/u/tylerjl)\
**Post date:** [March 4, 2016, 9:07pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554/4 "2016-03-04T21:07:57Z")

</div>

Hi @cpitzak, the first thing I'd suggest is defining your list for `network.host` as a native puppet array rather than a static string. Your config is outputting

```
["myhost","_local_"]

```

Because that's the literal string you've defined in:

```
$es_config['network.host'] = "['${hostname}','_local_']"
```

---

<div class="post-metadata">

**Author:** ![net](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@net](https://discuss.elastic.co/u/net)\
**Post date:** [March 4, 2016, 9:10pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554/5 "2016-03-04T21:10:56Z")

</div>

@tylerjl thanks, that worked!

---

<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:** [July 5, 2017, 11:11pm UTC](https://discuss.elastic.co/t/elasticsearch-puppet-error/43554/6 "2017-07-05T23:11:05Z")

</div>


