From 7952643b01ce91646c0fcc64341ddabd15038dbe Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 11 Jul 2017 11:48:28 -0300 Subject: Uses apt::packages::dpa and apt::packages::ppa --- files/deb.sury.org.gpg | Bin 0 -> 2239 bytes manifests/init.pp | 12 +++++--- manifests/packages/dpa.pp | 67 +++++++++++++++++++++++++++++++++++++++++++ manifests/packages/ppa.pp | 55 +++++++++++++++++++++++++++++++++++ manifests/packages/xenial.pp | 55 ----------------------------------- 5 files changed, 130 insertions(+), 59 deletions(-) create mode 100644 files/deb.sury.org.gpg create mode 100644 manifests/packages/dpa.pp create mode 100644 manifests/packages/ppa.pp delete mode 100644 manifests/packages/xenial.pp diff --git a/files/deb.sury.org.gpg b/files/deb.sury.org.gpg new file mode 100644 index 0000000..dc4d282 Binary files /dev/null and b/files/deb.sury.org.gpg differ diff --git a/manifests/init.pp b/manifests/init.pp index c654076..52ac0d4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,8 +18,11 @@ class php($hardened = true) { case $::lsbdistcodename { - 'xenial': { - include php::packages::xenial + 'xenial','stretch': { + include php::packages::ppa + } + 'stretch': { + include php::packages::dpa } default: { include php::packages::default @@ -27,8 +30,9 @@ class php($hardened = true) { } $folder = $::lsbdistcodename ? { - 'xenial' => '/etc/php/5.6', - default => '/etc/php5', + 'xenial' => '/etc/php/5.6', + 'stretch' => '/etc/php/5.6', + default => '/etc/php5', } file { [ "${folder}", "${folder}/cli", "${folder}/apache2", "${folder}/cli/conf.d", "${folder}/apache2/conf.d" ]: diff --git a/manifests/packages/dpa.pp b/manifests/packages/dpa.pp new file mode 100644 index 0000000..1af6ab9 --- /dev/null +++ b/manifests/packages/dpa.pp @@ -0,0 +1,67 @@ +class php::packages::dpa { + file { '/etc/apt/trusted.gpg.d/deb.sury.org-php.gpg': + ensure => present, + owner => "root", + group => "root", + mode => "0644", + source => 'pupet:///modules/php/files/deb.sury.org.gpg', + } + + file { '/etc/apt/sources.list.d/php.list' : + ensure => present, + owner => "root", + group => "root", + mode => "0644", + content => "deb https://packages.sury.org/php/ ${::lsbdistcodename} main\n", + require => File['/etc/apt/trusted.gpg.d/php.gpg'], + notify => Exec['php-apt-auto-update'], + } + + exec { 'php-apt-auto-update': + command => "/usr/bin/apt-get update", + user => "root", + refreshonly => true, + } + + # The needed packages: we could also try libapache2-mod-php5.6filter + package { 'php5': + name => 'php5.6', + require => File['/etc/apt/sources.list.d/php.list', + } + + package { 'php5-cli': + name => 'php5.6-cli', + require => File['/etc/apt/sources.list.d/php.list', + } + + package { [ 'php5.6-mysql', 'php5.6-sqlite3', 'php5.6-curl', 'php5.6-gmp', 'libapache2-mod-php5.6' ]: + ensure => installed, + require => File['/etc/apt/sources.list.d/php.list', + } + + # Optional packages + package { [ "php5.6-gd", "php-imagick" ]: + ensure => installed, + require => File['/etc/apt/sources.list.d/php.list', + } + + # Not available anymore + package { 'php5.6-suhosin': + ensure => absent, + require => File['/etc/apt/sources.list.d/php.list', + } + + # The needed apache modules + apache::module { 'php5.6': + ensure => present, + require => Package['libapache2-mod-php5.6'], + } + + # Default alternative + file { "/etc/alternatives/php": + ensure => "/usr/bin/php5.6", + owner => root, + group => root, + require => Package['php5'], + } +} diff --git a/manifests/packages/ppa.pp b/manifests/packages/ppa.pp new file mode 100644 index 0000000..4dc4f7a --- /dev/null +++ b/manifests/packages/ppa.pp @@ -0,0 +1,55 @@ +class php::packages::ppa { + #package { 'python-software-properties': + # ensure => present, + #} + + ## TODO: check repository key! + #exec { 'add-apt-repository-ondrej-php': + # command => '/usr/bin/add-apt-repository -y ppa:ondrej/php && apt-get update', + # user => 'root', + # creates => '/etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.list', + # require => Package['python-software-properties'], + #} + + # The needed packages: we could also try libapache2-mod-php5.6filter + package { 'php5': + name => 'php5.6', + #require => Exec['add-apt-repository-ondrej-php'], + } + + package { 'php5-cli': + name => 'php5.6-cli', + #require => Exec['add-apt-repository-ondrej-php'], + } + + package { [ 'php5.6-mysql', 'php5.6-sqlite3', 'php5.6-curl', 'php5.6-gmp', 'libapache2-mod-php5.6' ]: + ensure => installed, + #require => Exec['add-apt-repository-ondrej-php'], + } + + # Optional packages + package { [ "php5.6-gd", "php-imagick" ]: + ensure => installed, + #require => Exec['add-apt-repository-ondrej-php'], + } + + # Not available anymore + package { 'php5.6-suhosin': + ensure => absent, + #require => Exec['add-apt-repository-ondrej-php'], + } + + # The needed apache modules + apache::module { 'php5.6': + ensure => present, + require => Package['libapache2-mod-php5.6'], + } + + # Default alternative + file { "/etc/alternatives/php": + ensure => "/usr/bin/php5.6", + owner => root, + group => root, + require => Package['php5'], + } +} diff --git a/manifests/packages/xenial.pp b/manifests/packages/xenial.pp deleted file mode 100644 index ef5cb63..0000000 --- a/manifests/packages/xenial.pp +++ /dev/null @@ -1,55 +0,0 @@ -class php::packages::xenial { - #package { 'python-software-properties': - # ensure => present, - #} - - ## TODO: check repository key! - #exec { 'add-apt-repository-ondrej-php': - # command => '/usr/bin/add-apt-repository -y ppa:ondrej/php && apt-get update', - # user => 'root', - # creates => '/etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.list', - # require => Package['python-software-properties'], - #} - - # The needed packages: we could also try libapache2-mod-php5.6filter - package { 'php5': - name => 'php5.6', - #require => Exec['add-apt-repository-ondrej-php'], - } - - package { 'php5-cli': - name => 'php5.6-cli', - #require => Exec['add-apt-repository-ondrej-php'], - } - - package { [ 'php5.6-mysql', 'php5.6-sqlite3', 'php5.6-curl', 'php5.6-gmp', 'libapache2-mod-php5.6' ]: - ensure => installed, - #require => Exec['add-apt-repository-ondrej-php'], - } - - # Optional packages - package { [ "php5.6-gd", "php-imagick" ]: - ensure => installed, - #require => Exec['add-apt-repository-ondrej-php'], - } - - # Not available anymore - package { 'php5.6-suhosin': - ensure => absent, - #require => Exec['add-apt-repository-ondrej-php'], - } - - # The needed apache modules - apache::module { 'php5.6': - ensure => present, - require => Package['libapache2-mod-php5.6'], - } - - # Default alternative - file { "/etc/alternatives/php": - ensure => "/usr/bin/php5.6", - owner => root, - group => root, - require => Package['php5'], - } -} -- cgit v1.2.3