package.pp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Class: nginx::package
  2. #
  3. # This module manages NGINX package installation
  4. #
  5. # Parameters:
  6. #
  7. # There are no default parameters for this class.
  8. #
  9. # Actions:
  10. #
  11. # Requires:
  12. #
  13. # Sample Usage:
  14. #
  15. # This class file is not called directly
  16. class nginx::package(
  17. $package_name = $::nginx::params::package_name,
  18. $package_source = 'nginx',
  19. $package_ensure = 'present',
  20. $package_flavor = undef,
  21. $manage_repo = $::nginx::params::manage_repo,
  22. ) inherits ::nginx::params {
  23. anchor { 'nginx::package::begin': }
  24. anchor { 'nginx::package::end': }
  25. case $::osfamily {
  26. 'redhat': {
  27. class { '::nginx::package::redhat':
  28. manage_repo => $manage_repo,
  29. package_source => $package_source,
  30. package_ensure => $package_ensure,
  31. package_name => $package_name,
  32. require => Anchor['nginx::package::begin'],
  33. before => Anchor['nginx::package::end'],
  34. }
  35. }
  36. 'debian': {
  37. class { '::nginx::package::debian':
  38. package_name => $package_name,
  39. package_source => $package_source,
  40. package_ensure => $package_ensure,
  41. manage_repo => $manage_repo,
  42. require => Anchor['nginx::package::begin'],
  43. before => Anchor['nginx::package::end'],
  44. }
  45. }
  46. 'Solaris': {
  47. # $package_name needs to be specified. SFEnginx,CSWnginx depending on
  48. # where you get it.
  49. if $package_name == undef {
  50. fail('You must supply a value for $package_name on Solaris')
  51. }
  52. package { 'nginx':
  53. ensure => $package_ensure,
  54. name => $package_name,
  55. source => $package_source,
  56. }
  57. }
  58. 'OpenBSD': {
  59. package { $package_name:
  60. ensure => $package_ensure,
  61. flavor => $package_flavor,
  62. }
  63. }
  64. default: {
  65. package { $package_name:
  66. ensure => $package_ensure,
  67. }
  68. }
  69. }
  70. }