I know that we can indicate a relationship between resources that determines the deployment order. But is it possible to create a relationship between resources on different nodes in Puppet?
For example, I have an apache web server in node A and a mysql server in node B. I want to start mysql first before starting the apache web server. How can I put it in puppet language?
I tried the following codes:
node ‘host1’ {
@@service { ‘mysql’:
ensure => running,
tag => ‘host1-mysql’,
}
}
node ‘host2’ {
service { ‘apache2’:
ensure => running,
}
Service<<| tag == ‘host1-mysql’ |>> -> Service[‘apache2’]
}
But this did not work - a compilation error occurred. Any other solution?
source
share