Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a puppet class 'php' which looks like the following:

    class php {
  case $operatingsystem {
    debian: {
      package {'php5-common':
        ensure => latest,
        provider => apt,
       }
      package {'php5-mysql': ensure => latest, provider => apt}
      package {'php5-gd': ensure => latest, provider => apt}
      package {'php5-fpm': ensure => latest, provider => apt}
      package {'php5-mcrypt': ensure => latest, provider => apt}
      package {'php5-memcache': ensure => latest, provider => apt}
    }
  }

  service { 'php5-fpm':
    ensure => running,
    enable => true,
  }
} 

I include the php class in the node configuration in /etc/puppet/manifests/site.pp

It looks like

node 'example' {
  include php
}

When I run puppet agent -t on the client it installs the packages, but it installs kind of too much. It also installs apache and I don't know where it gets it from. I don't have any config in puppet for apache.

I guess it's using the debian recommendations or suggestions, but I'm not sure, because I disabled that on the server.

cat > /etc/apt/apt.conf.d/01norecommend 

The log output on the client is

Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/last_run.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppi_projects.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Caching catalog for eample
Info: Applying configuration version '1383041633'
Error: Could not prefetch package provider 'apt': invalid byte sequence in US-ASCII
Notice: /Stage[main]/Php/Package[php5-mysql]/ensure: ensure changed 'purged' to 'latest'
Notice: /Stage[main]/Php/Package[php5-gd]/ensure: ensure changed 'purged' to 'latest'
Notice: /Stage[main]/Php/Package[php5-mcrypt]/ensure: ensure changed 'purged' to 'latest'
Notice: /Stage[main]/Php/Package[php5-memcache]/ensure: ensure changed 'purged' to 'latest'
Notice: /Stage[main]/Php/Package[php5-fpm]/ensure: ensure changed 'purged' to 'latest'
Notice: Finished catalog run in 11.31 seconds

The following packages are installed after that

ii apache2-mpm-prefork 2.2.22-13 amd64 Apache HTTP Server - traditional non-threaded model ii apache2-utils 2.2.22-13 amd64 utility programs for webservers ii apache2.2-bin 2.2.22-13 amd64 Apache HTTP Server common binary files ii apache2.2-common 2.2.22-13 amd64 Apache HTTP Server common files ii libapache2-mod-php5filter 5.4.4-14+deb7u5 amd64 server-side, HTML-embedded scripting language (apache 2 filter module) ii libapache2-mod-php5filter 5.4.4-14+deb7u5 amd64 server-side, HTML-embedded scripting language (apache 2 filter module) ii php5-common 5.4.4-14+deb7u5 amd64 Common files for packages built from the php5 source ii php5-fpm 5.4.4-14+deb7u5 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary) ii php5-gd 5.4.4-14+deb7u5 amd64 GD module for php5 ii php5-mcrypt 5.4.4-14+deb7u5 amd64 MCrypt module for php5 ii php5-memcache 3.0.6-6 amd64 memcache extension module for PHP5 ii php5-mysql 5.4.4-14+deb7u5 amd64 MySQL module for php5

When I run apt-get install $php-package-names it won't install apache, just when I use apache. That's kind of annoying, because I'm going to use nginx.

Do you have an idea how I can get puppet to install the packages normally without apache as dependency?

share|improve this question
    
Could you check reverse dependencies with "apt-get rdepends <package>"? There might be some traces there. –  norrland Oct 29 '13 at 14:53
    
Thanks, the problem is solved now. apt-rdepends showed traces to phpapi-20100525, a virtual package. aptitude show phpapi-20100525 outputs: Provided by: libapache2-mod-php5, libapache2-mod-php5filter, libphp5-embed, php5-cgi, php5-cli, php5-fpm As Shane already wrote it will use the first one, in this case libapache2-mod-php5. –  rizon1990 Oct 30 '13 at 1:58

1 Answer 1

up vote 2 down vote accepted

Make php5-fpm install before the others with require.

The gd, memcache, mcrypt, and mysql packages require the virtual package phpapi-20100525, which is provided by libapache2-mod-php5 or by php5-fpm.

When you install them in a single command, it's already installing one of the packages that fulfills the requirement. When run separately as Puppet resources, apt is forced to pick one and picks the Apache library.

share|improve this answer
    
Thanks, that solved the problem. I'd upvote you, but I just signed up yesterday and it requires at least 15 reputation. –  rizon1990 Oct 30 '13 at 1:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.