dev/provisioning/modules/apache/manifests/balancermember.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # == Define Resource Type: apache::balancermember
       
     2 #
       
     3 # This type will setup a balancer member inside a listening service
       
     4 # configuration block in /etc/apache/apache.cfg on the load balancer.
       
     5 # currently it only has the ability to specify the instance name, url and an
       
     6 # array of options. More features can be added as needed. The best way to
       
     7 # implement this is to export this resource for all apache balancer member
       
     8 # servers, and then collect them on the main apache load balancer.
       
     9 #
       
    10 # === Requirement/Dependencies:
       
    11 #
       
    12 # Currently requires the puppetlabs/concat module on the Puppet Forge and
       
    13 # uses storeconfigs on the Puppet Master to export/collect resources
       
    14 # from all balancer members.
       
    15 #
       
    16 # === Parameters
       
    17 #
       
    18 # [*name*]
       
    19 # The title of the resource is arbitrary and only utilized in the concat
       
    20 # fragment name.
       
    21 #
       
    22 # [*balancer_cluster*]
       
    23 # The apache service's instance name (or, the title of the apache::balancer
       
    24 # resource). This must match up with a declared apache::balancer resource.
       
    25 #
       
    26 # [*url*]
       
    27 # The url used to contact the balancer member server.
       
    28 #
       
    29 # [*options*]
       
    30 # An array of options to be specified after the url.
       
    31 #
       
    32 # === Examples
       
    33 #
       
    34 # Exporting the resource for a balancer member:
       
    35 #
       
    36 # @@apache::balancermember { 'apache':
       
    37 #   balancer_cluster => 'puppet00',
       
    38 #   url              => "ajp://${::fqdn}:8009"
       
    39 #   options          => ['ping=5', 'disablereuse=on', 'retry=5', 'ttl=120'],
       
    40 # }
       
    41 #
       
    42 define apache::balancermember(
       
    43   $balancer_cluster,
       
    44   $url = "http://${::fqdn}/",
       
    45   $options = [],
       
    46 ) {
       
    47 
       
    48   concat::fragment { "BalancerMember ${name}":
       
    49     ensure  => present,
       
    50     target  => "${::apache::params::confd_dir}/balancer_${balancer_cluster}.conf",
       
    51     content => inline_template(" BalancerMember ${url} <%= @options.join ' ' %>\n"),
       
    52   }
       
    53 }