aboutsummaryrefslogtreecommitdiff
path: root/manifests/fpm.pp
blob: 497dc073d7abeb0cfdbe88a7dff8660aeb01f2f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
define php::fpm(
  $series,
  $ensure = 'present',
) {
  if $series == '5' {
    $version = $::php::params::version5
    $folder  = $::php::series5::folder
  }
  else {
    $version = $::php::params::version7
    $folder  = $::php::series7::folder
  }

  package { "php${version}-fpm":
    ensure => $ensure,
  }

  if $ensure == 'present' {
    service { "php${version}-fpm":
      ensure  => running,
      require => Package["php${version}-fpm"],
    }
  }

  #$::php::params::version7_previous.each |$item| {
  #  package { "php${item}-fpm":
  #    ensure => absent,
  #  }
  #}

  #apache::module { [ "proxy_fcgi", "setenvif" ]:
  #  #ensure  => $ensure,
  #  ensure  => present,
  #  require => Package["apache"],
  #}

  file { [ "${folder}/fpm", "${folder}/fpm/conf.d" ]:
    ensure => $ensure ? {
      'present' => directory,
      default   => undef,
    },
    require => Package["php${version}-fpm"],
  }
}