diff modules/php/manifests/repo/ubuntu.pp @ 386:3fce34f642f1

Add a PHP module to handle platform differences
author IBBoard <dev@ibboard.co.uk>
date Mon, 03 Jan 2022 17:09:39 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/php/manifests/repo/ubuntu.pp	Mon Jan 03 17:09:39 2022 +0000
@@ -0,0 +1,28 @@
+# Configure ubuntu ppa
+#
+# === Parameters
+#
+# [*version*]
+#   PHP version to manage (e.g. 5.6)
+#
+class php::repo::ubuntu (
+  Pattern[/^\d\.\d/] $version = '5.6',
+) {
+  if $facts['os']['name'] != 'Ubuntu' {
+    fail("class php::repo::ubuntu does not work on OS ${facts['os']['name']}")
+  }
+  include 'apt'
+
+  if ($version == '5.5') {
+    fail('PHP 5.5 is no longer available for download')
+  }
+
+  $version_repo = $version ? {
+    '5.4'   => 'ondrej/php5-oldstable',
+    default => 'ondrej/php'
+  }
+
+  ::apt::ppa { "ppa:${version_repo}":
+    package_manage => true,
+  }
+}