example42 / puppet-php

A puppet module for php. According to Example42 NextGen spec.
Other
45 stars 62 forks source link

Cannot install php (5.6.19) on Centos 7x #111

Open jeff1evesque opened 8 years ago

jeff1evesque commented 8 years ago

I'm unable to install php version 5.6.19, using the following class definition, within my Centos 7x environment:

class { 'php':
  version => '5.6.19',
}

Since I'm using puppet to provision my vagrant instance of centos 7x, I've reduced the above thought to the following configure_php.pp definition:

# variables
$working_dir = '/home/provisioner'

## define $PATH for all execs
Exec {path => ['/usr/bin/', '/usr/sbin/']}

## update yum using the added EPEL repository
class update_yum {
    exec { 'update-yum':
        command => 'yum -y update',
        timeout => 750,
    }
}

## install php
class install_php {
    ## set dependency
    require update_yum

    ## install php
    class { 'php': }
}

## constructor
class constructor {
    ## set dependency
    contain update_yum
    contain install_php
}
include constructor

When I run the above manifest, within my vagrant implementation:

[provisioner@drupal-demonstration ~]$ vagrant up
...
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment development...
==> default: Error: Evaluation Error: Unknown function: 'params_lookup'. at /tmp
/vagrant-puppet/modules-3caf511b1ed192516806c35da44e64ef/php/manifests/init.pp:1
52:26 on node drupal-demonstration.com
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

In an attempt reduce the debug time, I implemented the same test, within the terminal console:

[provisioner@drupal-demonstration ~]$ cd ~
[provisioner@drupal-demonstration ~]$ ls
[provisioner@drupal-demonstration ~]$ puppet module install example42-php
Notice: Preparing to install into /home/provisioner/.puppetlabs/etc/code/modules
 ...
Notice: Created target directory /home/provisioner/.puppetlabs/etc/code/modules
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/home/provisioner/.puppetlabs/etc/code/modules
└─┬ example42-php (v2.0.25)
  └── example42-puppi (v2.1.12)
[provisioner@drupal-demonstration ~]$ sudo vi install_php.pp
[provisioner@drupal-demonstration ~]$ puppet apply install_php.pp
Warning: Config file /home/provisioner/.puppetlabs/etc/code/hiera.yaml not found
, using Hiera defaults
Notice: Compiled catalog for drupal-demonstration.com in environment production
in 1.57 seconds
Error: Could not find dependent Service[httpd] for File[php.conf] at /home/provi
sioner/.puppetlabs/etc/code/modules/php/manifests/init.pp:258

The following was my install_php.pp defintion:

## install php
class install_php {
    class { 'php': }
}
contain install_php
jeff1evesque commented 8 years ago

Forgot to mention that I've already installed the example42/puppi dependency:

[provisioner@drupal-demonstration ~]$ puppet module install example42-puppi
Notice: Preparing to install into /home/provisioner/.puppetlabs/etc/code/modules
 ...
Notice: Module example42-puppi 2.1.12 is already installed.
jeff1evesque commented 8 years ago

To correspond to the earlier traceback error:

Error: Could not find dependent Service[httpd] for File[php.conf] at /home/provi sioner/.puppetlabs/etc/code/modules/php/manifests/init.pp:258

I adjusted the install_php.pp:

## variables: non-ssl
$port = '80'

## variables: ssl
$ssl_dir       = '/etc/ssl/httpd'
$port_ssl      = '443'
$port_ssl_host = '8334'
$ssl_country   = 'US'
$ssl_state     = 'CA'
$ssl_city      = 'Hollywood'
$ssl_org_name  = 'Production'
$ssl_org_unit  = 'Dreamworks'
$ssl_cname     = 'localhost'

## variables: general
$webroot            = '/vagrant/webroot'
$build_environment  = development
$vhost_name         = 'localhost'
$selinux_policy_dir = '/vagrant/centos7x/selinux/'
$packages_general   = ['dos2unix']

class httpd {
    ## variables
    $webroot = '/vagrant/webroot'

    ## install apache, without default vhost
    class { 'apache':
        default_vhost    => false,
    }

    ## enable 'mod_headers'
    class { 'apache::mod::headers': }

    ## allow port 443 to serve webpage
    apache::listen { '443': }

    ## enable php5 module
    include apache::mod::php

    ## standard vhost (default not defined)
    apache::vhost { "${vhost_name}":
        servername       => $vhost_name,
        port             => $port,
        docroot          => $webroot,
        redirect_status  => 'permanent',
        redirect_dest    => "https://${vhost_name}"
    }

    ## ssl vhost (default not defined)
    #
    #  @add_listen, setting to false, prevents 'Listen $port_ssl' directive
    #      within 'ports.conf', which would conflict with similar directive,
    #      found in 'ssl.conf'
    apache::vhost { "${vhost_name}_ssl":
        servername      => $vhost_name,
        port            => $port_ssl,
        add_listen      => false,
        docroot         => $webroot,
        ssl             => true,
        ssl_cert        => "${ssl_dir}/httpd.crt",
        ssl_key         => "${ssl_dir}/httpd.key",

        directories => [
            {
                path            => '/',
                provider        => 'directory',
                allow_override   => 'None',
                require         => 'all denied',
            },
            {
                path            => $webroot,
                provider        => 'directory',
                allow_override   => 'All',
                require         => 'all granted',
                options         => ['Indexes', 'FollowSymLinks'],
            },
        ],
    }
}

## install php
class install_php {
    ## set dependencies
    require httpd

    ## install php
    class { 'php':
        version => '5.6.19',
    }
}
contain install_php

However, I still was not able to install php 5.6.19, on centos 7x:

[root@drupal-demonstration provisioner]# puppet module install puppetlabs-apach
e
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/m
odules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└─┬ puppetlabs-apache (v1.8.1)
  ├── puppetlabs-concat (v2.1.0)
  └── puppetlabs-stdlib (v4.11.0)
[root@drupal-demonstration provisioner]# puppet module install example42-puppi
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/m
odules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└── example42-puppi (v2.1.12)
[root@drupal-demonstration provisioner]# puppet module install example42-php
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/m
odules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└─┬ example42-php (v2.0.25)
  └── example42-puppi (v2.1.12)
[root@drupal-demonstration provisioner]# puppet apply install_php.pp
Warning: Scope(Concat::Fragment[Apache ports header]): The $ensure parameter to
concat::fragment is deprecated and has no effect.
Warning: Scope(Concat::Fragment[Listen 443]): The $ensure parameter to concat::f
ragment is deprecated and has no effect.
Warning: Scope(Concat::Fragment[Listen 80]): The $ensure parameter to concat::fr
agment is deprecated and has no effect.
Notice: Compiled catalog for drupal-demonstration.com in environment production
in 1.87 seconds
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.d/ssl.conf]/ensure: removed
Notice: /Stage[main]/Apache::Mod::Mime/File[mime.conf]/content: content changed
'{md5}82476f6d2e6819f5db88eba8395615d8' to '{md5}9da85e58f3bd6c780ce76db603b7f02
8'
Notice: /Stage[main]/Apache::Mod::Mime_magic/File[mime_magic.conf]/content: cont
ent changed '{md5}b9061a13b522d13d822ffacbb6119aab' to '{md5}b258529b332429e2ff8
344f726a95457'
Notice: /Stage[main]/Apache::Mod::Alias/File[alias.conf]/content: content change
d '{md5}2f94b7abc6650a7c874bc4b2cf62dd42' to '{md5}983e865be85f5e0daaed7433db829
95e'
Error: Could not update: Execution of '/bin/yum -d 0 -e 0 -y install php-5.6.19'
 returned 1: Error: Nothing to do
Error: /Stage[main]/Php/Package[php]/ensure: change from purged to 5.6.19 failed
: Could not update: Execution of '/bin/yum -d 0 -e 0 -y install php-5.6.19' retu
rned 1: Error: Nothing to do
Notice: /Stage[main]/Php/File[php.conf]: Dependency Package[php] has failures: t
rue
Warning: /Stage[main]/Php/File[php.conf]: Skipping because of failed dependencie
s
Notice: /Stage[main]/Apache::Mod::Php/File[php5.conf]/ensure: defined content as
 '{md5}65c847fb8f6c4f2b6dab004589b90b52'
Notice: /Stage[main]/Apache::Mod::Headers/Apache::Mod[headers]/File[headers.load
]/ensure: defined content as '{md5}96094c96352002c43ada5bdf8650ff38'
Notice: /Stage[main]/Apache::Mod::Php/Apache::Mod[php5]/File[php5.load]/ensure:
defined content as '{md5}5aabed26d29e38135b5157acff80a2a6'
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost]/File[/vagrant/webroot]/owner
: owner changed 'provisioner' to 'root'
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost]/File[/vagrant/webroot]/group
: group changed 'provisioner' to 'root'
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost]/Concat[25-localhost.conf]/Fi
le[/etc/httpd/conf.d/25-localhost.conf]/content: content changed '{md5}425602e35
488b6d853b11d824241f23f' to '{md5}e692f2f6f6f48d986924d6ac477d21ad'
Notice: /Stage[main]/Apache::Mod::Ssl/File[ssl.conf]/content: content changed '{
md5}e802ccccca845c4c7e1bf0764af57c8a' to '{md5}8884ea33793365e0784cfd43be72464e'

Notice: /Stage[main]/Httpd/Apache::Vhost[localhost_ssl]/Concat[25-localhost_ssl.
conf]/File[/etc/httpd/conf.d/25-localhost_ssl.conf]/content: content changed '{m
d5}6a87e769095cdccc5ac6eab0274302ac' to '{md5}7c2f9f4264a16ba442fb5d7e2f6f6edd'
Notice: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/File[/etc/httpd/c
onf/ports.conf]/content: content changed '{md5}334fa5cddbf9a408ea1ca7a1666b1fc4'
 to '{md5}7c4742adc3e33066c74a24c77716ccce'
Notice: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]/content: content ch
anged '{md5}b761a40cd0e61eef44a486e0143f9125' to '{md5}c737309f707b785cb7760b6d1
9f7520f'
Notice: /Stage[main]/Apache::Service/Service[httpd]: Dependency Package[php] has
 failures: true
Warning: /Stage[main]/Apache::Service/Service[httpd]: Skipping because of failed
 dependencies
Notice: Applied catalog in 1.58 seconds
[root@drupal-demonstration provisioner]# php -v
bash: php: command not found
jeff1evesque commented 8 years ago

I adjusted install_php.pp, to not install a specific php version (5.6.19), and install the default version:

## variables: non-ssl
$port = '80'

## variables: ssl
$ssl_dir       = '/etc/ssl/httpd'
$port_ssl      = '443'
$port_ssl_host = '8334'
$ssl_country   = 'US'
$ssl_state     = 'CA'
$ssl_city      = 'Hollywood'
$ssl_org_name  = 'Production'
$ssl_org_unit  = 'Dreamworks'
$ssl_cname     = 'localhost'

## variables: general
$webroot            = '/vagrant/webroot'
$build_environment  = development
$vhost_name         = 'localhost'
$selinux_policy_dir = '/vagrant/centos7x/selinux/'
$packages_general   = ['dos2unix']

class httpd {
    ## variables
    $webroot = '/vagrant/webroot'

    ## install apache, without default vhost
    class { 'apache':
        default_vhost    => false,
    }

    ## enable 'mod_headers'
    class { 'apache::mod::headers': }

    ## allow port 443 to serve webpage
    apache::listen { '443': }

    ## enable php5 module
    include apache::mod::php

    ## standard vhost (default not defined)
    apache::vhost { "${vhost_name}":
        servername       => $vhost_name,
        port             => $port,
        docroot          => $webroot,
        redirect_status  => 'permanent',
        redirect_dest    => "https://${vhost_name}"
    }

    ## ssl vhost (default not defined)
    #
    #  @add_listen, setting to false, prevents 'Listen $port_ssl' directive
    #      within 'ports.conf', which would conflict with similar directive,
    #      found in 'ssl.conf'
    apache::vhost { "${vhost_name}_ssl":
        servername      => $vhost_name,
        port            => $port_ssl,
        add_listen      => false,
        docroot         => $webroot,
        ssl             => true,
        ssl_cert        => "${ssl_dir}/httpd.crt",
        ssl_key         => "${ssl_dir}/httpd.key",

        directories => [
            {
                path            => '/',
                provider        => 'directory',
                allow_override   => 'None',
                require         => 'all denied',
            },
            {
                path            => $webroot,
                provider        => 'directory',
                allow_override   => 'All',
                require         => 'all granted',
                options         => ['Indexes', 'FollowSymLinks'],
            },
        ],
    }
}

## install php
class install_php {
    ## set dependencies
    require httpd

    ## install php
    class { 'php': }
}
contain install_php

which generates the following traceback:

[root@drupal-demonstration provisioner]# puppet apply install_php.pp
Warning: Scope(Concat::Fragment[Apache ports header]): The $ensure parameter to
concat::fragment is deprecated and has no effect.
Warning: Scope(Concat::Fragment[Listen 443]): The $ensure parameter to concat::f
ragment is deprecated and has no effect.
Warning: Scope(Concat::Fragment[Listen 80]): The $ensure parameter to concat::fr
agment is deprecated and has no effect.
Notice: Compiled catalog for drupal-demonstration.com in environment production
in 1.87 seconds
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.d/ssl.conf]/ensure: removed
Notice: /Stage[main]/Apache::Mod::Mime/File[mime.conf]/content: content changed
'{md5}82476f6d2e6819f5db88eba8395615d8' to '{md5}9da85e58f3bd6c780ce76db603b7f02
8'
Notice: /Stage[main]/Apache::Mod::Mime_magic/File[mime_magic.conf]/content: cont
ent changed '{md5}b9061a13b522d13d822ffacbb6119aab' to '{md5}b258529b332429e2ff8
344f726a95457'
Notice: /Stage[main]/Apache::Mod::Alias/File[alias.conf]/content: content change
d '{md5}2f94b7abc6650a7c874bc4b2cf62dd42' to '{md5}983e865be85f5e0daaed7433db829
95e'
Notice: /Stage[main]/Php/Package[php]/ensure: created
Notice: /Stage[main]/Apache::Mod::Php/File[php5.conf]/ensure: defined content as
 '{md5}65c847fb8f6c4f2b6dab004589b90b52'
Notice: /Stage[main]/Apache::Mod::Headers/Apache::Mod[headers]/File[headers.load
]/ensure: defined content as '{md5}96094c96352002c43ada5bdf8650ff38'
Notice: /Stage[main]/Apache::Mod::Php/Apache::Mod[php5]/File[php5.load]/ensure:
defined content as '{md5}5aabed26d29e38135b5157acff80a2a6'
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost]/File[/vagrant/webroot]/owner
: owner changed 'provisioner' to 'root'
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost]/File[/vagrant/webroot]/group
: group changed 'provisioner' to 'root'
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost]/Concat[25-localhost.conf]/Fi
le[/etc/httpd/conf.d/25-localhost.conf]/content: content changed '{md5}425602e35
488b6d853b11d824241f23f' to '{md5}e692f2f6f6f48d986924d6ac477d21ad'
Notice: /Stage[main]/Apache::Mod::Ssl/File[ssl.conf]/content: content changed '{
md5}e802ccccca845c4c7e1bf0764af57c8a' to '{md5}8884ea33793365e0784cfd43be72464e'

Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/10-php.conf]/ensure:
removed
Notice: /Stage[main]/Httpd/Apache::Vhost[localhost_ssl]/Concat[25-localhost_ssl.
conf]/File[/etc/httpd/conf.d/25-localhost_ssl.conf]/content: content changed '{m
d5}6a87e769095cdccc5ac6eab0274302ac' to '{md5}7c2f9f4264a16ba442fb5d7e2f6f6edd'
Notice: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/File[/etc/httpd/c
onf/ports.conf]/content: content changed '{md5}334fa5cddbf9a408ea1ca7a1666b1fc4'
 to '{md5}7c4742adc3e33066c74a24c77716ccce'
Notice: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]/content: content ch
anged '{md5}b761a40cd0e61eef44a486e0143f9125' to '{md5}c737309f707b785cb7760b6d1
9f7520f'
Notice: /Stage[main]/Apache::Service/Service[httpd]: Triggered 'refresh' from 1
events
Notice: Applied catalog in 4.92 seconds
[root@drupal-demonstration provisioner]# php -v
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Although, no errors were present within the above traceback, the overall goal was to install php 5.6.19, not 5.4.16.

alvagante commented 8 years ago

So, the version you specify must be available in your repos. The executed command is /bin/yum -d 0 -e 0 -y install php-5.6.19, so I suppose that version is not actually available via yum.

jeff1evesque commented 8 years ago

@alvagante, should this repository have corresponding logic that attempts to download the corresponding packages, before installing them? Or, is that responsibility something that I must remediate?

alvagante commented 8 years ago

Well the module doesn't go as far. It supports installation only via native package managers and doesn't manage eventual additional repos. So what you can do is to provide the repos you need in your wrapper class and then specify an existing version in the repo.