Reputation: 23187
My current script looks like:
es_conf = elasticsearch_configure 'elasticsearch' do
allocated_memory '512m'
configuration ({
'http.port' => port,
'cluster.name' => cluster_name,
'node.name' => node_name,
'bootstrap.memory_lock' => false,
'discovery.zen.minimum_master_nodes' => 1
})
end
es_conf.path_data data_location if data_location
elasticsearch_plugin 'repository-s3' do
action :install
end
elasticsearch_plugin 'x-pack' do
action :install
end
elasticsearch_configure 'elasticsearch' do
configuration ({
'http.port' => port,
'cluster.name' => cluster_name,
'node.name' => node_name,
'bootstrap.memory_lock' => false,
'discovery.zen.minimum_master_nodes' => 1,
'xpack.monitoring.enabled' => true,
'xpack.graph.enabled' => false,
'xpack.watcher.enabled' => true
})
end
It's currently working to me (I mean it configures elasticsearch as I want). Nevertheless, I'm aware it's not so fine enought. I mean, I'm using elasticsearch_configure
twice. The problem is I first need to configure elasticsearch, then I need to install x-pack
and then configuring elasticsearch with specific x-pack
values.
Any ideas in order to do it a bit more elegant?
Exactly, I mean how should I change es_conf
?
Upvotes: 1
Views: 376
Reputation: 54181
So the second resource will truly be a separate resource, not a modification of the first. In Chef 12 it will "clone" the state of the first, but in Chef 13 the two are entirely unrelated other than sharing a name.
The general purpose fix for this would be to use edit_resource
but since you already have the resource object locally you could do this:
es_conf.configuration.update({new: keys, go: here})
Upvotes: 2