# Setting node.master and node.data in Chef recipe

**URL:** <https://discuss.elastic.co/t/setting-node-master-and-node-data-in-chef-recipe/40867>\
**Category:** Elasticsearch\
**Created:** [February 3, 2016, 12:10pm UTC](https://discuss.elastic.co/t/setting-node-master-and-node-data-in-chef-recipe/40867 "2016-02-03T12:10:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![StephenGoodall](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@StephenGoodall](https://discuss.elastic.co/u/StephenGoodall)\
**Post date:** [February 3, 2016, 12:10pm UTC](https://discuss.elastic.co/t/setting-node-master-and-node-data-in-chef-recipe/40867/1 "2016-02-03T12:10:12Z")

</div>

Hi,  
Does anyone know if it is possible to set the node.master and node.data values in a recipe?  
The resource configuration ([https://github.com/elastic/cookbook-elasticsearch/blob/master/libraries/resource\_configure.rb](https://github.com/elastic/cookbook-elasticsearch/blob/master/libraries/resource_configure.rb)) says this:  
# Refer to ES documentation on how to configure these to a  
# specific node role/type instead of using the defaults  
#  
# 'node.data' =\> ?,  
# 'node.master' =\> ?, # Refer to ES documentation on how to configure these to a  
# specific node role/type instead of using the defaults  
# # Refer to ES documentation on how to configure these to a  
# specific node role/type instead of using the defaults  
#  
# 'node.data' =\> ?,  
# 'node.master' =\> ?,  
# 'node.data' =\> ?,  
# 'node.master' =\> ?,

But I couldn't see anything in the docs about using chef to set these, I was hoping i could set it in the JSON attributes so I can pass a different value in depending on the node type I am starting up.

I made a new cookbook which uses the official cookbook and it runs this recipe:  
#  
# Cookbook Name:: elastic  
# Recipe:: default  
#  
# Copyright (c) 2016 The Authors, All Rights Reserved.  
elasticsearch\_user 'elasticsearch'

```
elasticsearch_install 'elasticsearch' do
type :package
end

elasticsearch_configure 'elasticsearch' do
configuration ({
'cluster.name' => 'ES_CLUSTER'
})
end

elasticsearch_service 'elasticsearch' do
service_actions [:enable, :start]
end

elasticsearch_plugin 'cloud-aws' do
action :install
notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed
end

elasticsearch_plugin 'elasticsearch-HQ' do
url 'royrusso/elasticsearch-HQ'
action :install
notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed
end

elasticsearch_plugin 'elasticsearch-gui' do
url 'jettro/elasticsearch-gui'
action :install
notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed
end

elasticsearch_plugin 'kopf' do
url 'lmenezes/elasticsearch-kopf'
action :install
notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed
end

```

I'm guessing that I can't just specify a nodemaster and nodedata in the JSON and change the config part to this?

```
elasticsearch_configure 'elasticsearch' do
configuration ({
'cluster.name' => 'ES_CLUSTER'
'node.master' => node[:elasticsearch][:nodemaster]
'node.data' => node[:elasticsearch][:nodedata]
})
end
```

---

<div class="post-metadata">

**Author:** ![StephenGoodall](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@StephenGoodall](https://discuss.elastic.co/u/StephenGoodall)\
**Post date:** [February 3, 2016, 3:24pm UTC](https://discuss.elastic.co/t/setting-node-master-and-node-data-in-chef-recipe/40867/2 "2016-02-03T15:24:23Z")

</div>

I figured this out, in case it helps anyone else.....you can set the values in the recipe:

`elasticsearch_configure 'elasticsearch' do configuration ({ 'node.master' => 'false', 'node.data' => 'false' }) end`

Thanks to the elastic team for writing the cookbook, feels a lot easier to use than other "non-official" ones I've used in the past

---

<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:19pm UTC](https://discuss.elastic.co/t/setting-node-master-and-node-data-in-chef-recipe/40867/3 "2017-07-05T23:19:15Z")

</div>


