2017-10-19 9 views
0

私は2つの料理本:elasticsearchとキュレーターを持っています。シェフ:別の料理本から既存のリソースを変更する

弾性の検索料理の本は、elasticsearchをインストールして設定します。 (elasticsearch料理本から)次のリソースは、キュレーターの料理から変更する必要があります。

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 

私はキュレーターの料理にそれを修正して、単一の行を追加する必要があります:私はそれを行うことができますどのように

'path.repo' => (["/backups/s3_currently_dev", "/backups/s3_currently", "/backups/s3_daily", "/backups/s3_weekly", "/backups/s3_monthly"]) 

を?

+0

あなたが使用してみました(https://docs.chef.io [edit_resourceを!] /dsl_recipe.html#id3)? – vase

+0

私はしなかった!あなたは小さな例を挙げることができますか? – Lechucico

答えて

0

私は当初chef-rewindの宝石を指し示すつもりでしたが、実際にはシェフに組み込まれているedit_resourceプロバイダを指しています。これの基本的な例:

# cookbook_a/recipes/default.rb 
file 'example.txt' do 
    content 'this is the initial content' 
end 

# cookbook_b/recipes/default.rb 
edit_resource! :file, 'example.txt' do 
    content 'modified content!' 
end 

これらの両方はシェフrun_listにある場合、example.txt内の実際のコンテンツが編集されたリソース、modified content!のものです。

完全にあなたのケースをテストすることなく、私はそうのように、プロバイダが同じように利用できると仮定しています:

edit_resource! :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, 

     'path.repo' => ["/backups/s3_currently_dev", "/backups/s3_currently", "/backups/s3_daily", "/backups/s3_weekly", "/backups/s3_monthly"] 
    }) 
end 
関連する問題