Commit 1a884786 authored by Russ Allbery's avatar Russ Allbery
Browse files

Update manifests for current Puppet coding standards

Fix formatting, valid parameter checks, and variable references to match
current Puppet coding standards.
parent bef35479
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ release/001.003 (unreleased)
    reloading Apache, in preparation for support for non-sysvinit init
    systems.  (rra)

    Fix formatting, valid parameter checks, variable references, and file
    layout to match current Puppet coding standards.  (rra)

release/001.002 (2013-09-23)

    Cleanup: remove the deprecated files/certs directory.  Certs are now
+28 −28
Original line number Diff line number Diff line
@@ -20,15 +20,15 @@ define apache::conf(
  $source    = undef,
  $content   = undef
) {
    if ($operatingsystem != 'debian') and ($operatingsystem != 'ubuntu') {
        fail "Unsupported apache::conf operating system ${operatingsystem}"
  if ($::operatingsystem != 'debian') and ($::operatingsystem != 'ubuntu') {
    fail("Unsupported apache::conf operating system ${::operatingsystem}")
  }
  $parent   = "/etc/apache2/${directory}"
  $realname = "${parent}/${name}"

  # Create the containing directory if it doesn't exist.  This is a bit of a
    # hack, but a file resource would conflict with other apache::conf
    # instances in the same directory.
  # hack, but a file resource would conflict with other apache::conf instances
  # in the same directory.
  #
  # This always runs even on ensure => absent since otherwise we get errors
  # from the missing dependency.
+90 −89
Original line number Diff line number Diff line
# This class handles the configuration of Apache such that clients external
# to ITS can manage the server.
# This class handles configuration of Apache such that people without root or
# Puppet access can manage the server.

class apache::local inherits apache {
  include group::webconfig,
          base::sudo
    
    # Ensure a local.conf file with correct permissions and change the
    # ownership of the logs.
    case $operatingsystem {
  # Ensure a local.conf file with correct permissions and change the ownership
  # of the logs.
  case $::operatingsystem {
    'redhat': {
      file { 
        '/etc/httpd/conf.d/local.conf':
                    require => Group['webconfig'],
          ensure  => file,
          group   => 'webconfig',
                    mode    => 664,
                    ensure  => file;
          mode    => '0664',
          require => Group['webconfig'];
        '/etc/httpd/conf.d/local.sample':
                    require => Group['webconfig'],
          content => template('apache/local.sample.erb'),
          group   => 'webconfig',
                    mode    => 644,
                    content => template('apache/local.sample.erb');
          mode    => '0644',
          require => Group['webconfig'];
        '/var/log/httpd':
                    require => Group['webconfig'],
          ensure  => directory,
          group   => 'webconfig',
                    mode    => 644,
                    ensure  => directory;
          mode    => '0644',
          require => Group['webconfig'];
        '/var/log/httpd/error_log':
                    require => Group['webconfig'],
          ensure  => file,
          group   => 'webconfig',
                    mode    => 644,
                    ensure  => file;
          mode    => '0644',
          require => Group['webconfig'];
        '/var/log/httpd/access_log':
                    require => Group['webconfig'],
          ensure  => file,
          group   => 'webconfig',
                    mode    => 644,
                    ensure  => file;
          mode    => '0644',
          require => Group['webconfig'];
      }
    }
    'debian', 'ubuntu': {
      file { 
        '/etc/apache2/conf.d/local':
                    group   => 'webconfig',
                    mode    => 664,
          ensure  => file,
          group   => 'webconfig',
          mode    => '0664',
          require => [ Group['webconfig'], Package['apache'] ];
        '/etc/apache2/conf.d/local.sample':
          group   => 'webconfig',
                    mode    => 644,
          mode    => '0644',
          content => template('apache/local.sample.erb'),
          require => [ Group['webconfig'], Package['apache'] ];
        '/var/log/apache2':
                    require => Group['webconfig'],
          ensure  => directory,
          group   => 'webconfig',
                    mode    => 644,
                    ensure  => directory;
          mode    => '0644',
          require => Group['webconfig'];
        '/var/log/apache2/error.log':
                    require => Group['webconfig'],
          ensure  => file,
          group   => 'webconfig',
                    mode    => 644,
                    ensure  => file;
          mode    => '0644',
          require => Group['webconfig'];
        '/var/log/apache2/access.log':
                    require => Group['webconfig'],
          ensure  => file,
          group   => 'webconfig',
                    mode    => 644,
                    ensure  => file;
          mode    => '0644',
          require => Group['webconfig'];
      }

    }
    default: {
      fail("Unsupported OS ${::operatingsystem} in apache::local")
  }

  # Ensure members of the webconfig group can sudo to control Apache.
@@ -90,7 +91,7 @@ class apache::local inherits apache {
    '/srv/www':
      ensure  => directory,
      group   => 'webconfig',
            mode    => 2775,
            require => Group['webconfig'],
      mode    => '02775',
      require => Group['webconfig'];
  }
}
+25 −24
Original line number Diff line number Diff line
@@ -8,14 +8,14 @@
# This infrastructure, and therefore this define, is only available on Debian.

define apache::module($ensure) {
    if ($operatingsystem != 'debian') and ($operatingsystem != 'ubuntu') {
        fail "Unsupported apache::module operating system ${operatingsystem}"
  if ($::operatingsystem != 'debian') and ($::operatingsystem != 'ubuntu') {
    fail("Unsupported apache::module operating system ${::operatingsystem}")
  }
    case $ensure {
        'present', 'absent': {}
        default: { fail "Invalid apache::module ensure value $ensure" }
  if !($ensure in [ 'present', 'absent' ]) {
    fail("ensure must be present or absent, not $ensure")
  }

  # Set various local variables to keep the exec readable.
  $modsdir = '/etc/apache2/mods-enabled'
  $module  = "${modsdir}/${name}"
  $cmd = $ensure ? {
@@ -27,6 +27,7 @@ define apache::module($ensure) {
    absent  => "! -e ${module}.load -a ! -e ${module}.conf",
  }

  # Enable or disable the module using a2enmod or a2dismod.
  exec { $cmd:
    command => $cmd,
    require => Package['apache'],
+43 −44
Original line number Diff line number Diff line
#
# Apache configuration for Red Hat.

class apache::redhat {
    case $lsbdistrelease {
        "3": {
  case $::lsbdistrelease {
    '3': {
      file { 
                "/etc/httpd/conf.d/ssl-strength.conf":
                    source  => "puppet:///modules/apache/ssl-strength.conf",
                    require => Package["apache"],
                    notify  => Service["apache"];
                "/etc/httpd/conf.d/ssl.conf":
                    source  => "puppet:///modules/apache/ssl.conf.RHEL",
                    require => Package["apache"],
                    notify  => Service["apache"];
                "/etc/httpd/conf.d/ssl-vhost.conf":
                    source  => "puppet:///modules/apache/ssl-vhost.conf.RHEL3-4",
                    require => Package["apache"],
                    notify  => Service["apache"];
        '/etc/httpd/conf.d/ssl-strength.conf':
          source  => 'puppet:///modules/apache/ssl-strength.conf',
          require => Package['apache'],
          notify  => Service['apache'];
        '/etc/httpd/conf.d/ssl.conf':
          source  => 'puppet:///modules/apache/ssl.conf.RHEL',
          require => Package['apache'],
          notify  => Service['apache'];
        '/etc/httpd/conf.d/ssl-vhost.conf':
          source  => 'puppet:///modules/apache/ssl-vhost.conf.RHEL3-4',
          require => Package['apache'],
          notify  => Service['apache'];
      }
    }
        "4": {
    '4': {
      # Do nothing for now
      # TODO: add ssl.conf for all RHEL4. 
      # TODO: add ssl-strength.conf for all RHEL4
@@ -27,22 +26,22 @@ class apache::redhat {
    # EL5 only
    default: {
      file { 
                "/etc/httpd/conf.d/trace.conf":
                    source  => "puppet:///modules/apache/trace.conf",
                    require => Package["apache"],
                    notify  => Service["apache"];
                "/etc/httpd/conf.d/ssl.conf":
                    source  => "puppet:///modules/apache/ssl.conf.RHEL",
                    require => Package["apache"],
                    notify  => Service["apache"];
                "/etc/httpd/conf.d/ssl-vhost.conf":
                    source  => "puppet:///modules/apache/ssl-vhost.conf.RHEL5",
                    require => Package["apache"],
                    notify  => Service["apache"];
                "/etc/httpd/conf.d/ssl-strength.conf":
                    source  => "puppet:///modules/apache/ssl-strength.conf",
                    require => Package["apache"],
                    notify  => Service["apache"];
        '/etc/httpd/conf.d/trace.conf':
          source  => 'puppet:///modules/apache/trace.conf',
          require => Package['apache'],
          notify  => Service['apache'];
        '/etc/httpd/conf.d/ssl.conf':
          source  => 'puppet:///modules/apache/ssl.conf.RHEL',
          require => Package['apache'],
          notify  => Service['apache'];
        '/etc/httpd/conf.d/ssl-vhost.conf':
          source  => 'puppet:///modules/apache/ssl-vhost.conf.RHEL5',
          require => Package['apache'],
          notify  => Service['apache'];
        '/etc/httpd/conf.d/ssl-strength.conf':
          source  => 'puppet:///modules/apache/ssl-strength.conf',
          require => Package['apache'],
          notify  => Service['apache'];
      }
    }
  }
Loading