aboutsummaryrefslogtreecommitdiff
path: root/manifests/series7.pp
blob: bc3a4b1d8ed57ba8f9e2afded3809c12cc54d17e (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class php::series7(
  $hardened       = true,
  $manage_mod_php = false,
) {
  case $::lsbdistcodename {
    'xenial': {
      include php::ppa
    }
    'trusty': {
      include php::ppa
    }
    'bookworm': {
      include php::dpa
    }
    'bullseye': {
      include php::dpa
    }
    'stretch': {
      include php::dpa
    }
    'buster': {
      include php::dpa
    }
  }

  $version = $::php::params::version7
  $folder  = "/etc/php/${version}"

  include php::series7::packages
  include php::resources
  include php::series7::defaults

  if $hardened == true {
    include php::series7::hardened
  }

  # The right apache module
  if $manage_mod_php == '7' {
    $version5 = $::php::params::version5
    $version8 = $::php::params::version8

    $::php::params::version7_previous.each |$item| {
      apache::module { "php${item}":
        ensure => absent,
      }
    }

    apache::module { "php${version5}":
      ensure  => absent,
      require => Package["libapache2-mod-php${version}"],
    }

    apache::module { "php${version}":
      ensure  => present,
      require => Package["libapache2-mod-php${version}"],
    }

    apache::module { "php${version8}":
      ensure  => absent,
      require => Package["libapache2-mod-php${version}"],
    }
  }

  file { [ "${folder}", "${folder}/cli", "${folder}/apache2", "${folder}/cli/conf.d", "${folder}/apache2/conf.d" ]:
    ensure  => directory,
    owner   => root,
    group   => root,
    mode    => '0755',
    require => Package['php'],
  }
}