Mercurial > repos > other > Puppet
view modules/website/manifests/php.pp @ 240:960e737a120e puppet-3.6
Deduplicate PHP opcache config files
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 20 Dec 2019 11:48:24 +0000 |
parents | 89cd717361fd |
children | c3fa3d65aa83 |
line wrap: on
line source
class website::php( $suffix = '', $opcache = undef, $extras = [], ) { File { notify => Service['httpd'], tag => 'website', } Package { notify => Service['httpd'], tag => 'website', } Package <| tag == 'website' |> -> File <| tag == 'website' |> define website::php::extra_php ($pkg = $title) { package { "php${website::php::suffix}-${pkg}": ensure => installed, } } website::php::extra_php { $extras: } if $suffix =~ /^7[1-9]w$/ { $php_core = "mod_php${suffix}" } else { $php_core = "php${suffix}" } $packages = [ $php_core, "php${suffix}-mbstring", "php${suffix}-xml", "php${suffix}-gd" ] package { $packages: ensure => installed, } file { '/etc/php.d/custom-lockdown.ini': ensure => present, content => 'allow_url_fopen = \'off\' expose_php = Off', } file { '/etc/php.d/custom-php.ini': ensure => present, source => 'puppet:///modules/website/custom-php.ini', } if $opcache { package { "php${suffix}-${opcache}": ensure => installed, notify => Service['httpd'], require => Package[$php_core], } # Use Remi's (and the OS's) naming convention file { '/etc/php.d/opcache.ini': ensure => absent, } file { '/etc/php.d/10-opcache.ini': ensure => present, source => 'puppet:///modules/website/opcache.ini', } } }