Defined Type: apache::dotconf

Defined in:
manifests/dotconf.pp

Overview

Define: apache::dotconf

General Apache define to be used to create generic custom .conf files Very simple wrapper to a normal file type Use source or template to define the source

Parameters

source

Sets the content of source parameter for the dotconf file If defined, apache dotconf file will have the param: source => $source

template

Sets the path to the template to use as content for dotconf file If defined, apache dotconf file has: content => content(“$template”) Note source and template parameters are mutually exclusive: don’t use both

Usage

apache::dotconf { “sarg”: source => ‘puppet://$servername/sarg/sarg.conf’ } or apache::dotconf { “trac”: content => template(“trac/apache.conf.erb”) }

Parameters:

  • enable (Any) (defaults to: true)
  • source (Any) (defaults to: '')
  • content (Any) (defaults to: '')
  • priority (Any) (defaults to: '')
  • ensure (Any) (defaults to: present)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'manifests/dotconf.pp', line 23

define apache::dotconf (
  $enable   = true,
  $source   = '' ,
  $content  = '' ,
  $priority = '',
  $ensure   = present,
) {

  $manage_file_source = $source ? {
    ''        => undef,
    default   => $source,
  }

  $manage_file_content = $content ? {
    ''        => undef,
    default   => $content,
  }

  # Config file path
  if $priority != '' {
    $dotconf_path = "${apache::dotconf_dir}/${priority}-${name}.conf"
  } else {
    $dotconf_path = "${apache::dotconf_dir}/${name}.conf"
  }

  # Config file enable path
  if $priority != '' {
    $dotconf_enable_path = "${apache::config_dir}/conf-enabled/${priority}-${name}.conf"
  } else {
    $dotconf_enable_path = "${apache::config_dir}/conf-enabled/${name}.conf"
  }

  file { "Apache_${name}.conf":
    ensure  => $ensure,
    path    => $dotconf_path,
    mode    => $apache::config_file_mode,
    owner   => $apache::config_file_owner,
    group   => $apache::config_file_group,
    require => Package['apache'],
    notify  => $apache::manage_service_autorestart,
    source  => $manage_file_source,
    content => $manage_file_content,
    audit   => $apache::manage_audit,
  }

  # Some OS specific settings:
  # Ubuntu 14 uses conf-available / conf-enabled folders
  case $::operatingsystem {
    /(?i:Ubuntu)/ : {
      case $::lsbmajdistrelease {
        /14/ : {
          $dotconf_link_ensure = $enable ? {
            true  => $dotconf_path,
            false => absent,
          }

          file { "ApacheDotconfEnabled_${name}":
            ensure  => $dotconf_link_ensure,
            path    => $dotconf_enable_path,
            require => Package['apache'],
          }
        }
        default: { }
      }
    }
    /(?i:Debian)/ : {
      case $::lsbmajdistrelease {
        /8/ : {
          $dotconf_link_ensure = $enable ? {
            true  => $dotconf_path,
            false => absent,
          }

          file { "ApacheDotconfEnabled_${name}":
            ensure  => $dotconf_link_ensure,
            path    => $dotconf_enable_path,
            require => Package['apache'],
          }
        }
        default: { }
      }
    }
    default: { }
  }
}