diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-12-31 18:22:12 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-12-31 18:22:12 -0300 |
commit | 74d515930abbf2278ac4387cb16f5f2ce5f08807 (patch) | |
tree | fcdbcc4e91991225ef06c144602c81f37839313e | |
parent | a344dbf14ca118ea4862f171d2111713607e54c6 (diff) | |
download | puppet-php-74d515930abbf2278ac4387cb16f5f2ce5f08807.tar.gz puppet-php-74d515930abbf2278ac4387cb16f5f2ce5f08807.tar.bz2 |
-rw-r--r-- | manifests/dpa.pp | 19 | ||||
-rw-r--r-- | manifests/params.pp | 11 | ||||
-rw-r--r-- | manifests/ppa.pp | 19 | ||||
-rw-r--r-- | manifests/repository.pp | 10 | ||||
-rw-r--r-- | manifests/series5.pp | 29 | ||||
-rw-r--r-- | manifests/series7.pp | 25 | ||||
-rw-r--r-- | manifests/series8.pp | 25 |
7 files changed, 96 insertions, 42 deletions
diff --git a/manifests/dpa.pp b/manifests/dpa.pp index d159b36..26cdf69 100644 --- a/manifests/dpa.pp +++ b/manifests/dpa.pp @@ -1,4 +1,12 @@ -class php::dpa inherits php::repository { +class php::dpa( + $ensure = 'present', +) { + class { 'php::repository': + ensure => $ensure, + content => "deb [signed-by=/etc/apt/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ ${::lsbdistcodename} main\n", + dependencies => File['/etc/apt/keyrings/deb.sury.org-php.gpg'], + } + # Old location file { '/etc/apt/trusted.gpg.d/deb.sury.org-php.gpg': ensure => absent, @@ -9,22 +17,17 @@ class php::dpa inherits php::repository { } file { '/etc/apt/keyrings/deb.sury.org-php.gpg': - ensure => present, + ensure => $ensure, owner => "root", group => "root", mode => "0644", source => 'puppet:///modules/php/deb.sury.org.gpg', } - File['/etc/apt/sources.list.d/php.list'] { - content => "deb [signed-by=/etc/apt/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ ${::lsbdistcodename} main\n", - require => File['/etc/apt/keyrings/deb.sury.org-php.gpg'], - } - # Pinning # Adapted from https://dmvrtx.me/2023/06/php-7.4-on-debian-bookworm/ file { '/etc/apt/preferences.d/php': - ensure => present, + ensure => $ensure, owner => "root", group => "root", mode => "0644", diff --git a/manifests/params.pp b/manifests/params.pp index 242645c..c7a665b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,12 +1,15 @@ class php::params { + # Previously, 8.4 was used as the default version. But many official Debian + # packages depend on the version currently shipped by Debian. $version8 = $::lsbdistcodename ? { - 'bookworm' => '8.4', - default => '8.4', + 'bookworm' => '8.2', + default => '8.2', } + # Any other version that may have been previously installed in the system. $version8_previous = $::lsbdistcodename ? { - 'bookworm' => [ '8.3', '8.2', '8.1', '8.0' ], - default => [ '8.3', '8.2', '8.1', '8.0' ], + 'bookworm' => [ '8.4', '8.3', '8.1', '8.0' ], + default => [ '8.4', '8.3', '8.1', '8.0' ], } $version7 = $::lsbdistcodename ? { diff --git a/manifests/ppa.pp b/manifests/ppa.pp index 07b96fa..70beec7 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -1,4 +1,12 @@ -class php::ppa inherits php::repository { +class php::ppa( + $ensure = 'present', +) { + class { 'php::repository': + ensure => $ensure, + content => "deb [signed-by=/etc/apt/keyrings/ondrej_ubuntu_php.gpg] http://ppa.launchpad.net/ondrej/php/ubuntu ${::lsbdistcodename} main\n", + dependencies => File['/etc/apt/keyrings/ondrej_ubuntu_php.gpg'], + } + #package { 'python-software-properties': # ensure => present, #} @@ -13,7 +21,7 @@ class php::ppa inherits php::repository { # Old location file { '/etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg': - ensure => present, + ensure => absent, owner => "root", group => "root", mode => "0644", @@ -22,16 +30,11 @@ class php::ppa inherits php::repository { } file { '/etc/apt/keyrings/ondrej_ubuntu_php.gpg': - ensure => present, + ensure => $ensure, owner => "root", group => "root", mode => "0644", source => 'puppet:///modules/php/ondrej_ubuntu_php.gpg', notify => Exec['php-apt-auto-update'], } - - File['/etc/apt/sources.list.d/php.list'] { - content => "deb [signed-by=/etc/apt/keyrings/ondrej_ubuntu_php.gpg] http://ppa.launchpad.net/ondrej/php/ubuntu ${::lsbdistcodename} main\n", - require => File['/etc/apt/keyrings/ondrej_ubuntu_php.gpg'], - } } diff --git a/manifests/repository.pp b/manifests/repository.pp index 01b4dbf..2c5ffd4 100644 --- a/manifests/repository.pp +++ b/manifests/repository.pp @@ -1,9 +1,15 @@ -class php::repository { +class php::repository( + $ensure = 'present', + $content = undef, + $dependencies = undef, +) { file { '/etc/apt/sources.list.d/php.list': - ensure => present, + ensure => $ensure, owner => "root", group => "root", mode => "0644", + content => $content, + require => $dependencies, notify => Exec['php-apt-auto-update'], } diff --git a/manifests/series5.pp b/manifests/series5.pp index 8a9149c..07cbc0d 100644 --- a/manifests/series5.pp +++ b/manifests/series5.pp @@ -1,25 +1,38 @@ class php::series5( $hardened = true, $manage_mod_php = false, + $deb_sury_repo = 'absent', ) { case $::lsbdistcodename { 'xenial': { - include php::ppa + class { 'php::ppa': + ensure => $deb_sury_repo, + } } 'trusty': { - include php::ppa + class { 'php::ppa': + ensure => $deb_sury_repo, + } } 'bookworm': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'bullseye': { - include php::dpa - } - 'buster': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'stretch': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } + } + 'buster': { + class { 'php::dpa': + ensure => $deb_sury_repo, + } } } diff --git a/manifests/series7.pp b/manifests/series7.pp index bc3a4b1..ba68097 100644 --- a/manifests/series7.pp +++ b/manifests/series7.pp @@ -1,25 +1,38 @@ class php::series7( $hardened = true, $manage_mod_php = false, + $deb_sury_repo = 'absent', ) { case $::lsbdistcodename { 'xenial': { - include php::ppa + class { 'php::ppa': + ensure => $deb_sury_repo, + } } 'trusty': { - include php::ppa + class { 'php::ppa': + ensure => $deb_sury_repo, + } } 'bookworm': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'bullseye': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'stretch': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'buster': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } } diff --git a/manifests/series8.pp b/manifests/series8.pp index 00192ea..c377c78 100644 --- a/manifests/series8.pp +++ b/manifests/series8.pp @@ -1,25 +1,38 @@ class php::series8( $hardened = true, $manage_mod_php = false, + $deb_sury_repo = 'absent', ) { case $::lsbdistcodename { 'xenial': { - include php::ppa + class { 'php::ppa': + ensure => $deb_sury_repo, + } } 'trusty': { - include php::ppa + class { 'php::ppa': + ensure => $deb_sury_repo, + } } 'bookworm': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'bullseye': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'stretch': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } 'buster': { - include php::dpa + class { 'php::dpa': + ensure => $deb_sury_repo, + } } } |