This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copying the php module files as mentioned in my earlier commit the re…
…ference we need for our dev environment to work does no longer exist
- Loading branch information
Showing
24 changed files
with
1,033 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.swp | ||
pkg/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Apache example | ||
class my_php { | ||
php::module { [ | ||
'gearman', 'curl', 'gd', 'gmagick', 'igbinary', | ||
'inotify', 'mcrypt', 'memcached', 'mogilefs', 'mysql', | ||
'pecl-http', 'proctitle', 'tidy', 'xhprof', 'intl', 'imap', | ||
'oauth', 'sphinx', | ||
]: | ||
require => Apt::Sources_list['dotdeb-php53'], | ||
notify => Service['apache'], | ||
} | ||
|
||
php::module { 'redis': | ||
ensure => absent, | ||
} | ||
|
||
php::module { 'xcache': | ||
content => 'global/etc/php5/conf.d/', | ||
require => Apt::Sources_list['dotdeb-php53'], | ||
notify => Service['apache'], | ||
} | ||
|
||
php::module { [ 'suhosin', 'xdebug', ]: | ||
require => Apt::Sources_list['dotdeb-php53'], | ||
notify => Service['apache'], | ||
source => true, | ||
} | ||
|
||
php::conf { [ 'browscap', 'global', ]: | ||
require => Apt::Sources_list['dotdeb-php53'], | ||
notify => Service['apache'], | ||
source => true, | ||
} | ||
|
||
php::conf { [ 'mysqli', 'pdo', 'pdo_mysql', ]: | ||
require => Package['php-mysql'], | ||
notify => Service['apache'], | ||
} | ||
|
||
php::extra { 'lite_php_browscap': | ||
require => Php::Conf['browscap'], | ||
notify => Service['apache'], | ||
source => true, | ||
} | ||
} | ||
|
||
|
||
# FPM example | ||
class my_fpm_php { | ||
php::module { [ 'curl', 'gd', 'mcrypt', 'mysql', 'suhosin', ]: | ||
notify => Class['php::fpm::service'], | ||
} | ||
|
||
php::module { [ 'memcache', 'apc', ]: | ||
notify => Class['php::fpm::service'], | ||
source => true, | ||
} | ||
|
||
# Add a pool definition | ||
php::fpm::pool { 'my_pool': | ||
source => 'puppet:///files/path/to/your/pool', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2011 Steffen Zieger | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name 'saz-php' | ||
version '1.0.1' | ||
source 'UNKNOWN' | ||
author 'saz' | ||
license 'Apache License, Version 2.0' | ||
summary 'UNKNOWN' | ||
description 'Manage cli, apache and fpm version of php via puppet' | ||
project_page 'https://github.com/saz/puppet-php' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# puppet-php | ||
|
||
puppet-php is a puppet module to manage PHP on your systems. | ||
You can manage the CLI, Apache and FPM version of PHP. | ||
|
||
## How to use | ||
|
||
#### CLI | ||
include php | ||
|
||
#### Apache | ||
include php::apache2 | ||
|
||
#### FPM | ||
include php::fpm | ||
|
||
*php::apache2* and *php::fpm* will include php automatically. | ||
|
||
|
||
|
||
### Installing PHP modules | ||
|
||
The easiest way of installing additional PHP modules is using packages | ||
from your distribution and the bundled configuration files. | ||
|
||
``` | ||
php::module { 'snmp': | ||
notify => [ Class['php::fpm::service'], Service['apache'], ], | ||
} | ||
``` | ||
|
||
Multiple modules are possible, too. | ||
|
||
``` | ||
php::module { ['snmp', 'xdebug', ]: | ||
notify => Class['php::fpm::service'], | ||
} | ||
``` | ||
|
||
Sometimes, modules require some custom configuration settings and you | ||
want to retrieve a file from the server. | ||
|
||
``` | ||
php::module { 'snmp': | ||
source => true, | ||
notify => Class['php::fpm::service'], | ||
} | ||
``` | ||
|
||
At first, this looks a bit strange. If you set `source` to `true`, | ||
a file will be fetched from multiple sources: | ||
|
||
1. 'puppet:///files/$fqdn/etc/php5/conf.d/module.ini' | ||
2. 'puppet:///files/$hostgroup/etc/php5/conf.d/module.ini' | ||
3. 'puppet:///files/$domain/etc/php5/conf.d/module.ini' | ||
4. 'puppet:///files/global/etc/php5/conf.d/module.ini' | ||
|
||
The first source that exists will be used. | ||
This makes it quite easy to have different files for different systems without | ||
duplicating any of your definitions. | ||
|
||
This is even possible, if you manage multiple modules! | ||
|
||
|
||
But if you really need to set a different source, this is possible, too. | ||
|
||
``` | ||
php::module { 'snmp': | ||
source => 'puppet:///files/different/path/to/the/file/', | ||
notify => Class['php::fpm::service'], | ||
} | ||
``` | ||
|
||
To make it still possible, to have multiple modules, this should point to a directory. | ||
In this directory, place files named *module.ini*. | ||
|
||
**Do not forget to add a trailing slash!** | ||
|
||
|
||
|
||
Sometimes you may need to use a template instead of a file. | ||
|
||
``` | ||
php::module { 'snmp': | ||
content => 'php5/conf.d/', | ||
notify => Class['php::fpm::service'], | ||
} | ||
``` | ||
|
||
You can define multiple modules, excactly like before with sources. | ||
The only difference is, that, at the moment, only one template per module will be used. | ||
|
||
Place your templates inside your template directory and name them 'module.ini.erb' | ||
|
||
|
||
|
||
### Additional configuration settings | ||
|
||
You can place additional configuration files in the 'conf.d' directory as follows: | ||
|
||
``` | ||
php::conf { "global": | ||
source => "puppet:///files/php/global.ini", | ||
} | ||
``` | ||
|
||
The same source fetching rules applies as in the 'modules' section. | ||
|
||
|
||
|
||
### Extra configuration files | ||
|
||
Those configuration files will be placed inside an 'extras' directory in your configuration root. | ||
This is to make sure, that those configuration files are not parsed by PHP by default. | ||
|
||
``` | ||
php::extra { 'lite_php_browscap': | ||
source => 'puppet:///files/php5/extra/lite_php_browscap.ini', | ||
require => Php::Conf['browscap'], | ||
notify => Class['php::fpm::service'], | ||
} | ||
``` | ||
|
||
You can use a template, too: | ||
|
||
``` | ||
php::extra { 'lite_php_browscap': | ||
content => 'php5/conf.d/', | ||
require => Php::Conf['browscap'], | ||
notify => Class['php::fpm::service'], | ||
} | ||
``` | ||
|
||
Again, the same source fetching rules applies as in the 'modules' section. | ||
|
||
For more informations, see EXAMPLE | ||
|
||
|
||
|
||
### Service Notification | ||
On every resource, you can define, what other service should be notified. | ||
If you run PHP within Apache, you want to notify Apache of any changes or | ||
FPM should be notified and restarted to make the new configuration work. | ||
|
||
|
||
|
||
### Requirements | ||
* php::apache2 requires *apache* module | ||
|
||
|
||
|
||
### TODO | ||
* Manage FPM configuration (global settings) | ||
* Document the usage of php::fpm::pool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class php::apache2($apache2_ini_content = undef, $apache2_ini_source = undef) { | ||
require apache | ||
include php, php::apache2::install, php::apache2::config | ||
|
||
Class["php::config"] ~> Service["apache"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class php::apache2::config { | ||
file { $php::params::apache_dir: | ||
owner => root, | ||
group => root, | ||
purge => true, | ||
recurse => true, | ||
force => true, | ||
require => Class['php::apache2::install'], | ||
notify => Service[$php::params::apache_service_name], | ||
ensure => directory, | ||
} | ||
|
||
file { "${php::params::apache_dir}conf.d": | ||
ensure => "../conf.d", | ||
require => File[$php::params::apache_dir], | ||
notify => Service[$php::params::apache_service_name], | ||
} | ||
|
||
file { $php::params::apache_ini: | ||
owner => root, | ||
group => root, | ||
require => Class['php::apache2::install'], | ||
notify => Service[$php::params::apache_service_name], | ||
content => $php::apache2::apache2_ini_content, | ||
source => $php::apache2::apache2_ini_source, | ||
ensure => file, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class php::apache2::install { | ||
package { $php::params::apache_package_name: | ||
ensure => present, | ||
notify => Service[$php::params::apache_service_name], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
define php::conf($ensure = present, $source = undef, $content = undef, $require = undef, $notify = undef) { | ||
include php | ||
|
||
$file_name = "${name}.ini" | ||
|
||
# Puppet will bail out if both source and content is set, | ||
# hence we don't have to deal with it. | ||
file { $file_name: | ||
path => "${php::params::conf_dir}${file_name}", | ||
mode => 644, | ||
owner => root, | ||
group => root, | ||
ensure => $ensure, | ||
notify => $notify, | ||
require => $require ? { | ||
undef => Class['php'], | ||
default => [ Class['php'], $require, ], | ||
}, | ||
source => $source ? { | ||
undef => undef, | ||
true => [ | ||
"puppet:///files/${fqdn}/etc/php5/conf.d/${file_name}", | ||
"puppet:///files/${hostgroup}/etc/php5/conf.d/${file_name}", | ||
"puppet:///files/${domain}/etc/php5/conf.d/${file_name}", | ||
"puppet:///files/global/etc/php5/conf.d/${file_name}", | ||
], | ||
default => "${source}${file_name}", | ||
}, | ||
content => $content ? { | ||
undef => undef, | ||
default => template("${content}${file_name}.erb"), | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class php::config { | ||
file { $php::params::extra_dir: | ||
owner => root, | ||
group => root, | ||
purge => true, | ||
recurse => true, | ||
force => true, | ||
require => Class["php::install"], | ||
ensure => directory, | ||
} | ||
|
||
file { $php::params::conf_dir: | ||
owner => root, | ||
group => root, | ||
purge => true, | ||
recurse => true, | ||
force => true, | ||
require => Class["php::install"], | ||
ensure => directory, | ||
} | ||
|
||
file { $php::params::cli_ini: | ||
owner => root, | ||
group => root, | ||
require => Class["php::install"], | ||
ensure => file, | ||
content => $php::cli_ini_content, | ||
source => $php::cli_ini_source, | ||
} | ||
|
||
file { $php::params::cli_dir: | ||
owner => root, | ||
group => root, | ||
purge => true, | ||
recurse => true, | ||
force => true, | ||
require => Class["php::install"], | ||
ensure => directory, | ||
} | ||
|
||
file { "${php::params::cli_dir}conf.d": | ||
ensure => "../conf.d", | ||
} | ||
} |
Oops, something went wrong.