title: Puppet: relationship between resources on different nodes
body: <p>I know that we can specify relationship between resources, which determines the deployment order. But is it possible to create relationship between resources on different nodes in Puppet?</p>
  
  <p>For example, I have apache web server in node A and mysql server in node B. I want to start mysql first before starting apache web server. How could I express this in Puppet language?</p>
  
  <hr>
  
  <p>I have tried the following codes:</p>
  
  <pre><code>node ‘host1’ {
    @@service { ‘mysql’:
      ensure =&gt; running,
      tag =&gt; ‘host1-mysql’,
    }
  }
  node ‘host2’ {
    service { ‘apache2’:
      ensure =&gt; running,
    }
    Service&lt;&lt;| tag == ‘host1-mysql’ |&gt;&gt; -&gt; Service[‘apache2’]
  }
  </code></pre>
  
  <p>But it didn't work - produced a compile error. Any other solution?</p>