2017-10-19 12 views
0

나는 두 개의 요리 책을 가지고 있습니다 : 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 보석을 가리키게되었지만 실제로는 Chef에 내장 된 edit_resource 제공자를 가리키고 있습니다. 이에 대한 기본 예 :

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

이 모두가 요리사 run_list에있는 경우

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

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