chef cookbook dependency on system software not on another cookbook

79 views Asked by At

As part of a platform setup orchestration we are using our python package to install various software packages on a cluster of machines in cloud.

We have the following scenario:

  1. Our python package initiates installation of certain software packages(say A,B,C) then simultaneously initiates installation of certain other (say D,E,F). (N.B:. D,E,F are through our chef cookbooks and A,B,C are through our python programs )

  2. Our problem is that software D(installs through chef cookbook) depends on software A.

  3. Since, D depends on A, cookbook for D does not find A in system and fails.

What I was thinking was, if we can have a dependency in chef cookbook saying that proceed only if A is found in system else wait!

Is it possible? are there any alternatives to above problem?

Thanks

2

There are 2 answers

0
phoenix On BEST ANSWER

I applied the following steps to solve my problem

  1. Found the directory which gets created after installation of the independent software
  2. waited for the directory to get created(using ruby block code for sleeping) and initiated the installation of dependent software thereafter to ensure the dependency is satisfied.

solved my issue..

4
kkamil On

You can consider using puppet. Whit puppet you can define required resources (eg. package) and also define relationships between resources.

E.g puppet manifest:

package { ["A", "B", "C", "E", "F"]:
  ensure => 'installed',
}

package { "D":
  ensure => 'installed',
  require => Package['A'],
}

UPDATE: updated example puppet manifest.