I'm trying to build the simple Puppet recipe as below:
package { 'openjdk-7-jre-headless' : ensure => installed, }
package { 'tomcat7-common' : ensure => installed, }
package { 'tomcat7' : ensure => installed, require => Package['tomcat7-common'],}
package { 'tomcat7-admin' : ensure => installed, require => Package['tomcat7-common'], }
However when run sudo puppet apply -v tomcat7.pp
, I've still these errors:
err: /Stage[main]//Package[tomcat7-common]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install tomcat7-common' returned 100: Reading package lists...
The following packages have unmet dependencies: tomcat7-common :
Depends: libtomcat7-java (>= 7.0.28-4+deb7u1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
And each time I'm adding new packages, my file is growing making it difficult to read. Do I really need to specify all Tomcat dependencies manually? Or is there any simpler way of doing it?
Puppet should deal with dependencies automatically, so the simple manifest which should work is:
However depending on the problems (like having old Tomcat installed or broken dependencies), these problems should be resolved manually. For example by manually running
apt-get tomcat7
and checking what's blocking it (e.g. 'The following packages will be REMOVED' section).Using Puppet, there is the following workaround:
Or by defining
absent
(orpurged
), such as:to ensure that conflicting packages are not installed on the machine.