
저는 2가지 레시피로 관리하는 복잡한 소프트웨어 스택을 가지고 있습니다.
recipe[stack::foo]
recipe[stack::bar]
foo
는 모든 서버에 설치되는 반면 bar
서버의 하위 집합에만 설치됩니다. bar
파일과 서비스에 따라 다릅니다 foo
.
레시피[스택::foo]
file 'fooFile' do
source 'somewhere'
notifies :restart, service[barService] #bar needs to be restart first, if it is present
notifies :restart, service[fooService]
end
service 'fooService' do
action :start
end
레시피[스택::바]
file 'barFile' do
source 'somewhere'
end
service 'barService' do
action :start
end
bar
레시피가 노드에 있으면 노드를 다시 시작 하도록 조건부 종속성을 만드는 것이 가능합니까 ? 그렇지 않은 경우 건너뜁니다.
나는 이런 것을 시도하고 있습니다.
file 'fooFile' do
source 'somewhere'
notifies :restart, service[barService] if exists? "service[barService]"
notifies :restart, service[fooService]
end
답변1
IRC에서 답변되었으며 사용자 spuder는 이중 요청이 권장되지 않는다고 알렸습니다.
tl;dr resources()
실행 목록을 사용하거나 확인하세요.