Mercurial > repos > other > Puppet
comparison modules/website/manifests/php.pp @ 399:2c6065b5be5e
Switch to config-based PHP extensions
This makes it compatible with Ubuntu, otherwise it keeps
trying to re-install the same module because the "phpX.X"
package is a virtual package and the Puppet handling of
Ubuntu's "is it installed" system is incapable of saying
"yes" when a virtual package is installed.
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 20 Apr 2022 19:08:14 +0100 |
parents | df5ad1612af7 |
children | f354100b688a |
comparison
equal
deleted
inserted
replaced
398:66c406eec60d | 399:2c6065b5be5e |
---|---|
58 'opcache.save_comments' => 1, | 58 'opcache.save_comments' => 1, |
59 'opcache.revalidate_freq' => 1, | 59 'opcache.revalidate_freq' => 1, |
60 } | 60 } |
61 }, | 61 }, |
62 xml => {}, | 62 xml => {}, |
63 }, | 63 } + $extras, |
64 } | 64 } |
65 apache::custom_config { "php.conf": | 65 apache::custom_config { "php.conf": |
66 ensure => present, | 66 ensure => present, |
67 source => "puppet:///modules/website/php.conf" | 67 source => "puppet:///modules/website/php.conf" |
68 } | 68 } |
69 class { ['apache::mod::proxy', 'apache::mod::proxy_fcgi']:} | 69 class { ['apache::mod::proxy', 'apache::mod::proxy_fcgi']:} |
70 | |
71 $extras.each |String $extra| { | |
72 ::php::extension { $extra: | |
73 ensure => present | |
74 } | |
75 } | |
76 | |
77 if false { | |
78 Package <| tag == 'php-package' |> -> File <| tag == 'php-file' |> ~> Service['php-fpm'] ~> Service['httpd'] | |
79 | |
80 $php_core = ($module != undef) ? { true => "php", default => "php${suffix}" } | |
81 | |
82 package { $php_core: | |
83 provider => ($module != undef) ? { true => 'dnfmodule', default => undef }, | |
84 ensure => ($module != undef) ? { true => $module, default => installed }, | |
85 tag => 'php-package', | |
86 } | |
87 | |
88 if $osfamily == 'RedHat' { | |
89 $php_conf_dir = '/etc/php.d/' | |
90 $php_fpm_conf_dir = '/etc/php-fpm.d/' | |
91 $mod_fcgid_package = 'mod_fcgid' | |
92 } | |
93 elsif $osfamily == 'Debian' { | |
94 # FIXME: This hard-codes the version number, which isn't great | |
95 $php_conf_dir = '/etc/php/7.4/fpm/conf.d/' | |
96 $php_fpm_conf_dir = $php_conf_dir | |
97 $mod_fcgid_package = 'libapache2-mod-fcgid' | |
98 } | |
99 | |
100 package { $mod_fcgid_package: | |
101 ensure => installed, | |
102 } | |
103 class { ['apache::mod::proxy', 'apache::mod::proxy_fcgi']:} | |
104 | |
105 $packages = [ "php${suffix}-mbstring", "php${suffix}-xml", "php${suffix}-gd", "php${suffix}-fpm" ] | |
106 package { $packages: | |
107 ensure => installed, | |
108 tag => 'php-package', | |
109 } | |
110 | |
111 service { 'php-fpm': | |
112 ensure => 'running', | |
113 enable => true, | |
114 } | |
115 | |
116 website::php::extra { $extras: } | |
117 | |
118 file { '/etc/php.d/datetime.ini': | |
119 ensure => present, | |
120 source => "puppet:///modules/website/datetime.ini", | |
121 require => Class['apache'], | |
122 notify => Service['httpd']; | |
123 } | |
124 file { '/etc/php-fpm.d/www.conf': | |
125 ensure => present, | |
126 source => 'puppet:///modules/website/php-fpm-www.conf', | |
127 tag => 'php-file', | |
128 } | |
129 file { '/etc/php.d/custom-lockdown.ini': | |
130 ensure => present, | |
131 content => 'allow_url_fopen = \'off\' | |
132 expose_php = Off', | |
133 tag => 'php-file', | |
134 } | |
135 file { '/etc/php.d/custom-php.ini': | |
136 ensure => present, | |
137 source => 'puppet:///modules/website/custom-php.ini', | |
138 tag => 'php-file', | |
139 } | |
140 | |
141 package { "php${suffix}-opcache": | |
142 ensure => installed, | |
143 require => Package[$php_core], | |
144 tag => 'php-package', | |
145 } | |
146 # Use Remi's (and the OS's) naming convention | |
147 file { '/etc/php.d/opcache.ini': | |
148 ensure => absent, | |
149 } | |
150 file { '/etc/php.d/10-opcache.ini': | |
151 ensure => present, | |
152 source => "puppet:///modules/website/opcache.ini", | |
153 tag => 'php-file', | |
154 } | |
155 } | 70 } |
156 } |