Puppet Class: pacemaker::remote

Defined in:
manifests/remote.pp

Overview

Copyright 2016 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Class: pacemaker::remote

Pacemaker remote manifest. This class is a small helper to set up a pacemaker remote node. It does not create the pacemaker-remote resource in the CIB but only sets up the remote service

Parameters

use_pcsd

(optional) Should the remote use pcsd to be setup Defaults to false

manage_fw

(optional) Manage or not IPtables rules. Defaults to true

remote_authkey

(Required) Authkey for pacemaker remote nodes Defaults to undef

pcsd_debug

(optional) Enable pcsd debugging Defaults to false

pcsd_bind_addr

(optional) List of IP addresses pcsd should bind to Defaults to undef

tls_priorities

(optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set Defaults to undef

Parameters:

  • remote_authkey (Any)
  • use_pcsd (Any) (defaults to: false)
  • pcs_user (Any) (defaults to: 'hacluster')
  • pcs_password (Any) (defaults to: undef)
  • manage_fw (Any) (defaults to: true)
  • pcsd_debug (Any) (defaults to: false)
  • pcsd_bind_addr (Any) (defaults to: undef)
  • tls_priorities (Any) (defaults to: undef)


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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'manifests/remote.pp', line 47

class pacemaker::remote (
  $remote_authkey,
  $use_pcsd        = false,
  $pcs_user        = 'hacluster',
  $pcs_password    = undef,
  $manage_fw       = true,
  $pcsd_debug      = false,
  $pcsd_bind_addr  = undef,
  $tls_priorities  = undef,
) {
  include ::pacemaker::params
  ensure_resource('package', $::pacemaker::params::pcmk_remote_package_list, {
    ensure => present
  })
  # pacemaker remote needs pcsd only with pcs >= 0.10
  if $use_pcsd {
    include ::pacemaker::install
    if $manage_fw {
      firewall { '001 pcsd':
        proto  => 'tcp',
        dport  => ['2224'],
        action => 'accept',
      }
      firewall { '001 pcsd ipv6':
        proto    => 'tcp',
        dport    => ['2224'],
        action   => 'accept',
        provider => 'ip6tables',
      }
    }

    $pcsd_debug_str = bool2str($pcsd_debug)
    file_line { 'pcsd_debug_ini':
      path    => $::pacemaker::params::pcsd_sysconfig,
      line    => "PCSD_DEBUG=${pcsd_debug_str}",
      match   => '^PCSD_DEBUG=',
      require => Class['::pacemaker::install'],
      before  => Service['pcsd'],
      notify  => Service['pcsd'],
    }

    if $pcsd_bind_addr != undef {
      file_line { 'pcsd_bind_addr':
        path    => $::pacemaker::params::pcsd_sysconfig,
        line    => "PCSD_BIND_ADDR='${pcsd_bind_addr}'",
        match   => '^PCSD_BIND_ADDR=',
        require => Class['::pacemaker::install'],
        before  => Service['pcsd'],
        notify  => Service['pcsd'],
      }
    }
    else {
      file_line { 'pcsd_bind_addr':
        ensure            => absent,
        path              => $::pacemaker::params::pcsd_sysconfig,
        match             => '^PCSD_BIND_ADDR=*',
        require           => Class['::pacemaker::install'],
        before            => Service['pcsd'],
        notify            => Service['pcsd'],
        match_for_absence => true,
      }
    }

    if $tls_priorities != undef {
      file_line { 'tls_priorities':
        path    => $::pacemaker::params::pcmk_sysconfig,
        line    => "PCMK_tls_priorities=${tls_priorities}",
        match   => '^PCMK_tls_priorities=',
        require => Class['::pacemaker::install'],
        before  => Service['pcsd'],
      }
    }

    user { $pcs_user:
      password => pw_hash($pcs_password, 'SHA-512', fqdn_rand_string(10)),
      groups   => 'haclient',
      require  => Class['::pacemaker::install'],
      before   => Service['pcsd'],
    }
    # only set up pcsd, not the other cluster services which have
    # very specific setup and when-to-start-up requirements
    # that are taken care of in corosync.pp
    service { 'pcsd':
      ensure     => running,
      hasstatus  => true,
      hasrestart => true,
      enable     => true,
      require    => Class['::pacemaker::install'],
    }
  } else {
  # This gets managed by pcsd directly when pcs is < 0.10
    Package<| title == 'pacemaker-remote' |> -> File <| title == 'etc-pacemaker' |>
    file { 'etc-pacemaker':
      ensure => directory,
      path   => '/etc/pacemaker',
      owner  => 'hacluster',
      group  => 'haclient',
      mode   => '0750',
    } ->
    file { 'etc-pacemaker-authkey':
      path    => '/etc/pacemaker/authkey',
      owner   => 'hacluster',
      group   => 'haclient',
      mode    => '0640',
      content => $remote_authkey,
    } ->
    service { 'pacemaker_remote':
      ensure => running,
      enable => true,
    }
  }
}