aboutsummaryrefslogtreecommitdiff
path: root/manifests/fpm.pp
blob: c4d5fc8e50d53dd4e187c60805a71d891ae8f498 (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
45
46
47
48
define php::fpm(
  $series,
  $ensure = 'present',
) {
  if $series == '5' {
    $version = $::php::params::version5
    $folder  = $::php::series5::folder
  }
  elsif $series == '7' {
    $version = $::php::params::version7
    $folder  = $::php::series7::folder
  }
  else {
    $version = $::php::params::version8
    $folder  = $::php::series8::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"],
  }
}