diff --git a/Puppetfile b/Puppetfile index 4919c899c..3d9c58f34 100644 --- a/Puppetfile +++ b/Puppetfile @@ -143,7 +143,7 @@ mod 'openstacklib', :git => 'https://github.com/stackforge/puppet-openstacklib.git' mod 'pacemaker', - :commit => '47c85172fedcf452acd004cc880a565e4a326c73', + :commit => '337f9c139b705135b4f65e72748b4c706323b695', :git => 'https://github.com/redhat-openstack/puppet-pacemaker.git' mod 'puppet', diff --git a/pacemaker/agent_generator/agent_generator.rb b/pacemaker/agent_generator/agent_generator.rb index 96196263f..f3c5b536b 100755 --- a/pacemaker/agent_generator/agent_generator.rb +++ b/pacemaker/agent_generator/agent_generator.rb @@ -56,35 +56,39 @@ def generate puts <<-eos # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::#{@parser.getAgentName} ( +define pacemaker::stonith::#{@parser.getAgentName} ( #{getManifestParameters} ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" +#{getVariableValues} + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::#{@parser.getAgentName}": - command => "/usr/sbin/pcs stonith delete stonith-#{@parser.getAgentName}-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-#{@parser.getAgentName}-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-#{@parser.getAgentName}-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - #{getVariableValues} - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "#{@parser.getPackageName}": ensure => installed, - } -> exec { - "Creating stonith::#{@parser.getAgentName}": - command => "/usr/sbin/pcs stonith create stonith-#{@parser.getAgentName}-${real_address} #{@parser.getAgentName} pcmk_host_list=\\"${pcmk_host_value_chunk}\\" #{getChunks} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-#{@parser.getAgentName}-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-#{@parser.getAgentName}-${safe_title} #{@parser.getAgentName} pcmk_host_list=\\"${pcmk_host_value_chunk}\\" #{getChunks} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::#{@parser.getAgentName} ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-#{@parser.getAgentName}-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-#{@parser.getAgentName}-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-#{@parser.getAgentName}-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } @@ -94,13 +98,16 @@ class pacemaker::stonith::#{@parser.getAgentName} ( def getManifestParameters text = "" @parser.getParameters.each { |p| - text += "\t$#{p['name']} = undef,\n" + text += " $#{p['name']} = undef,\n" } text += "\n" - text += "\t$interval = \"60s\",\n" - text += "\t$ensure = present,\n" - text += "\t$pcmk_host_value = undef,\n" + text += " $interval = \"60s\",\n" + text += " $ensure = present,\n" + text += " $pcmk_host_list = undef,\n" + text += "\n" + text += " $tries = undef,\n" + text += " $try_sleep = undef," return text end @@ -108,10 +115,10 @@ def getManifestParameters def getVariableValues text = "" @parser.getParameters.each { |p| - text += "\t$#{p['name']}_chunk = $#{p['name']} ? {\n" - text += "\t\tundef => \"\",\n" - text += "\t\tdefault => \"#{p['name']}=\\\"${#{p['name']}}\\\"\",\n" - text += "\t}\n" + text += " $#{p['name']}_chunk = $#{p['name']} ? {\n" + text += " undef => \"\",\n" + text += " default => \"#{p['name']}=\\\"${#{p['name']}}\\\"\",\n" + text += " }\n" } return text diff --git a/pacemaker/agent_generator/src_xml/fence_xvm.xml b/pacemaker/agent_generator/src_xml/fence_xvm.xml new file mode 100644 index 000000000..15d00e607 --- /dev/null +++ b/pacemaker/agent_generator/src_xml/fence_xvm.xml @@ -0,0 +1,86 @@ + + +fence_xvm is an I/O Fencing agent which can be used withvirtual machines. + + + + + Specify (stdin) or increment (command line) debug level + + + + + IP Family ([auto], ipv4, ipv6) + + + + + Multicast address (default=225.0.0.12 / ff05::3:1) + + + + + TCP, Multicast, or VMChannel IP port (default=1229) + + + + + Multicast retransmit time (in 1/10sec; default=20) + + + + + Authentication (none, sha1, [sha256], sha512) + + + + + Packet hash strength (none, sha1, [sha256], sha512) + + + + + Shared key file (default=/etc/cluster/fence_xvm.key) + + + + + Virtual Machine (domain name) to fence + + + + + Treat [domain] as UUID instead of domain name. This is provided for compatibility with older fence_xvmd installations. + + + + + Fencing action (null, off, on, [reboot], status, list, monitor, metadata) + + + + + Fencing timeout (in seconds; default=30) + + + + + Fencing delay (in seconds; default=0) + + + + + Virtual Machine (domain name) to fence (deprecated; use port) + + + + + + + + + + + + + diff --git a/pacemaker/agent_generator/variables.sh b/pacemaker/agent_generator/variables.sh index a6e38a029..247e941ed 100644 --- a/pacemaker/agent_generator/variables.sh +++ b/pacemaker/agent_generator/variables.sh @@ -30,6 +30,7 @@ cmd_pkg_map=( "fence_virt:fence-virt" "fence_vmware_soap:fence-agents-vmware-soap" "fence_wti:fence-agents-wti" - # not generating fence_xvm for now, it would overwrite the existing one + + # These have manual changes and need to be updated manually: # "fence_xvm:fence-virt" ) diff --git a/pacemaker/manifests/stonith/fence_apc.pp b/pacemaker/manifests/stonith/fence_apc.pp index 13f6b6663..8229e6931 100644 --- a/pacemaker/manifests/stonith/fence_apc.pp +++ b/pacemaker/manifests/stonith/fence_apc.pp @@ -1,148 +1,154 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_apc ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $cmd_prompt = undef, - $secure = undef, - $port = undef, - $switch = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_apc ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $cmd_prompt = undef, + $secure = undef, + $port = undef, + $switch = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $switch_chunk = $switch ? { + undef => "", + default => "switch=\"${switch}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_apc": - command => "/usr/sbin/pcs stonith delete stonith-fence_apc-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_apc-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_apc-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_apc-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_apc-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $switch_chunk = $switch ? { - undef => "", - default => "switch=\"${switch}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-apc": ensure => installed, - } -> exec { - "Creating stonith::fence_apc": - command => "/usr/sbin/pcs stonith create stonith-fence_apc-${real_address} fence_apc pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${switch_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_apc-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_apc-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_apc-${safe_title} fence_apc pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${switch_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_apc-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_apc ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_apc-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_apc-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_apc-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_apc_snmp.pp b/pacemaker/manifests/stonith/fence_apc_snmp.pp index fd1a508b1..959519e1e 100644 --- a/pacemaker/manifests/stonith/fence_apc_snmp.pp +++ b/pacemaker/manifests/stonith/fence_apc_snmp.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_apc_snmp ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_apc_snmp ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_apc_snmp": - command => "/usr/sbin/pcs stonith delete stonith-fence_apc_snmp-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_apc_snmp-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_apc_snmp-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_apc_snmp-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_apc_snmp-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-apc-snmp": ensure => installed, - } -> exec { - "Creating stonith::fence_apc_snmp": - command => "/usr/sbin/pcs stonith create stonith-fence_apc_snmp-${real_address} fence_apc_snmp pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_apc_snmp-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_apc_snmp-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_apc_snmp-${safe_title} fence_apc_snmp pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_apc_snmp-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_apc_snmp ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_apc_snmp-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_apc_snmp-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_apc_snmp-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_bladecenter.pp b/pacemaker/manifests/stonith/fence_bladecenter.pp index 175e25dfc..415b5cc54 100644 --- a/pacemaker/manifests/stonith/fence_bladecenter.pp +++ b/pacemaker/manifests/stonith/fence_bladecenter.pp @@ -1,148 +1,154 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_bladecenter ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $cmd_prompt = undef, - $secure = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $missing_as_off = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_bladecenter ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $cmd_prompt = undef, + $secure = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $missing_as_off = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $missing_as_off_chunk = $missing_as_off ? { + undef => "", + default => "missing_as_off=\"${missing_as_off}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_bladecenter": - command => "/usr/sbin/pcs stonith delete stonith-fence_bladecenter-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_bladecenter-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_bladecenter-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_bladecenter-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_bladecenter-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $missing_as_off_chunk = $missing_as_off ? { - undef => "", - default => "missing_as_off=\"${missing_as_off}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-bladecenter": ensure => installed, - } -> exec { - "Creating stonith::fence_bladecenter": - command => "/usr/sbin/pcs stonith create stonith-fence_bladecenter-${real_address} fence_bladecenter pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${missing_as_off_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_bladecenter-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_bladecenter-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_bladecenter-${safe_title} fence_bladecenter pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${missing_as_off_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_bladecenter-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_bladecenter ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_bladecenter-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_bladecenter-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_bladecenter-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_brocade.pp b/pacemaker/manifests/stonith/fence_brocade.pp index d06dc8712..b30b70b58 100644 --- a/pacemaker/manifests/stonith/fence_brocade.pp +++ b/pacemaker/manifests/stonith/fence_brocade.pp @@ -1,143 +1,149 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_brocade ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $cmd_prompt = undef, - $secure = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_brocade ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $cmd_prompt = undef, + $secure = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_brocade": - command => "/usr/sbin/pcs stonith delete stonith-fence_brocade-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_brocade-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_brocade-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_brocade-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_brocade-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-brocade": ensure => installed, - } -> exec { - "Creating stonith::fence_brocade": - command => "/usr/sbin/pcs stonith create stonith-fence_brocade-${real_address} fence_brocade pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_brocade-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_brocade-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_brocade-${safe_title} fence_brocade pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_brocade-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_brocade ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_brocade-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_brocade-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_brocade-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_cisco_mds.pp b/pacemaker/manifests/stonith/fence_cisco_mds.pp index eab35940f..a914bbd6b 100644 --- a/pacemaker/manifests/stonith/fence_cisco_mds.pp +++ b/pacemaker/manifests/stonith/fence_cisco_mds.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_cisco_mds ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_cisco_mds ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_cisco_mds": - command => "/usr/sbin/pcs stonith delete stonith-fence_cisco_mds-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_cisco_mds-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_cisco_mds-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_cisco_mds-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_cisco_mds-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-cisco-mds": ensure => installed, - } -> exec { - "Creating stonith::fence_cisco_mds": - command => "/usr/sbin/pcs stonith create stonith-fence_cisco_mds-${real_address} fence_cisco_mds pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_cisco_mds-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_cisco_mds-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_cisco_mds-${safe_title} fence_cisco_mds pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_cisco_mds-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_cisco_mds ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_cisco_mds-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_cisco_mds-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_cisco_mds-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_cisco_ucs.pp b/pacemaker/manifests/stonith/fence_cisco_ucs.pp index 0acb7a49e..cff71744d 100644 --- a/pacemaker/manifests/stonith/fence_cisco_ucs.pp +++ b/pacemaker/manifests/stonith/fence_cisco_ucs.pp @@ -1,148 +1,154 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_cisco_ucs ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $ssl = undef, - $notls = undef, - $port = undef, - $suborg = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $ssl_secure = undef, - $ssl_insecure = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_cisco_ucs ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $ssl = undef, + $notls = undef, + $port = undef, + $suborg = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $ssl_secure = undef, + $ssl_insecure = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $ssl_chunk = $ssl ? { + undef => "", + default => "ssl=\"${ssl}\"", + } + $notls_chunk = $notls ? { + undef => "", + default => "notls=\"${notls}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $suborg_chunk = $suborg ? { + undef => "", + default => "suborg=\"${suborg}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $ssl_secure_chunk = $ssl_secure ? { + undef => "", + default => "ssl_secure=\"${ssl_secure}\"", + } + $ssl_insecure_chunk = $ssl_insecure ? { + undef => "", + default => "ssl_insecure=\"${ssl_insecure}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_cisco_ucs": - command => "/usr/sbin/pcs stonith delete stonith-fence_cisco_ucs-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_cisco_ucs-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_cisco_ucs-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_cisco_ucs-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_cisco_ucs-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $ssl_chunk = $ssl ? { - undef => "", - default => "ssl=\"${ssl}\"", - } - $notls_chunk = $notls ? { - undef => "", - default => "notls=\"${notls}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $suborg_chunk = $suborg ? { - undef => "", - default => "suborg=\"${suborg}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $ssl_secure_chunk = $ssl_secure ? { - undef => "", - default => "ssl_secure=\"${ssl_secure}\"", - } - $ssl_insecure_chunk = $ssl_insecure ? { - undef => "", - default => "ssl_insecure=\"${ssl_insecure}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-cisco-ucs": ensure => installed, - } -> exec { - "Creating stonith::fence_cisco_ucs": - command => "/usr/sbin/pcs stonith create stonith-fence_cisco_ucs-${real_address} fence_cisco_ucs pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${port_chunk} ${suborg_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_cisco_ucs-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_cisco_ucs-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_cisco_ucs-${safe_title} fence_cisco_ucs pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${port_chunk} ${suborg_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_cisco_ucs-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_cisco_ucs ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_cisco_ucs-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_cisco_ucs-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_cisco_ucs-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_drac5.pp b/pacemaker/manifests/stonith/fence_drac5.pp index 6e3f54d63..8fdf9e7f1 100644 --- a/pacemaker/manifests/stonith/fence_drac5.pp +++ b/pacemaker/manifests/stonith/fence_drac5.pp @@ -1,148 +1,154 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_drac5 ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $cmd_prompt = undef, - $secure = undef, - $drac_version = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_drac5 ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $cmd_prompt = undef, + $secure = undef, + $drac_version = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $drac_version_chunk = $drac_version ? { + undef => "", + default => "drac_version=\"${drac_version}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_drac5": - command => "/usr/sbin/pcs stonith delete stonith-fence_drac5-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_drac5-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_drac5-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_drac5-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_drac5-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $drac_version_chunk = $drac_version ? { - undef => "", - default => "drac_version=\"${drac_version}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-drac5": ensure => installed, - } -> exec { - "Creating stonith::fence_drac5": - command => "/usr/sbin/pcs stonith create stonith-fence_drac5-${real_address} fence_drac5 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${drac_version_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_drac5-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_drac5-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_drac5-${safe_title} fence_drac5 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${drac_version_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_drac5-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_drac5 ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_drac5-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_drac5-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_drac5-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_eaton_snmp.pp b/pacemaker/manifests/stonith/fence_eaton_snmp.pp index 826d2e357..036e97558 100644 --- a/pacemaker/manifests/stonith/fence_eaton_snmp.pp +++ b/pacemaker/manifests/stonith/fence_eaton_snmp.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_eaton_snmp ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_eaton_snmp ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_eaton_snmp": - command => "/usr/sbin/pcs stonith delete stonith-fence_eaton_snmp-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_eaton_snmp-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_eaton_snmp-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_eaton_snmp-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_eaton_snmp-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-eaton-snmp": ensure => installed, - } -> exec { - "Creating stonith::fence_eaton_snmp": - command => "/usr/sbin/pcs stonith create stonith-fence_eaton_snmp-${real_address} fence_eaton_snmp pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_eaton_snmp-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_eaton_snmp-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_eaton_snmp-${safe_title} fence_eaton_snmp pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_eaton_snmp-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_eaton_snmp ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_eaton_snmp-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_eaton_snmp-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_eaton_snmp-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_eps.pp b/pacemaker/manifests/stonith/fence_eps.pp index f25d9b298..aea36acc9 100644 --- a/pacemaker/manifests/stonith/fence_eps.pp +++ b/pacemaker/manifests/stonith/fence_eps.pp @@ -1,128 +1,134 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_eps ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $hidden_page = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_eps ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $hidden_page = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $hidden_page_chunk = $hidden_page ? { + undef => "", + default => "hidden_page=\"${hidden_page}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_eps": - command => "/usr/sbin/pcs stonith delete stonith-fence_eps-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_eps-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_eps-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_eps-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_eps-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $hidden_page_chunk = $hidden_page ? { - undef => "", - default => "hidden_page=\"${hidden_page}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-eps": ensure => installed, - } -> exec { - "Creating stonith::fence_eps": - command => "/usr/sbin/pcs stonith create stonith-fence_eps-${real_address} fence_eps pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${hidden_page_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_eps-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_eps-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_eps-${safe_title} fence_eps pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${hidden_page_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_eps-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_eps ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_eps-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_eps-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_eps-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_hpblade.pp b/pacemaker/manifests/stonith/fence_hpblade.pp index de9f42bf8..4eef367d7 100644 --- a/pacemaker/manifests/stonith/fence_hpblade.pp +++ b/pacemaker/manifests/stonith/fence_hpblade.pp @@ -1,148 +1,154 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_hpblade ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $cmd_prompt = undef, - $secure = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $missing_as_off = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_hpblade ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $cmd_prompt = undef, + $secure = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $missing_as_off = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $missing_as_off_chunk = $missing_as_off ? { + undef => "", + default => "missing_as_off=\"${missing_as_off}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_hpblade": - command => "/usr/sbin/pcs stonith delete stonith-fence_hpblade-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_hpblade-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_hpblade-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_hpblade-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_hpblade-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $missing_as_off_chunk = $missing_as_off ? { - undef => "", - default => "missing_as_off=\"${missing_as_off}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-hpblade": ensure => installed, - } -> exec { - "Creating stonith::fence_hpblade": - command => "/usr/sbin/pcs stonith create stonith-fence_hpblade-${real_address} fence_hpblade pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${missing_as_off_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_hpblade-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_hpblade-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_hpblade-${safe_title} fence_hpblade pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${missing_as_off_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_hpblade-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_hpblade ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_hpblade-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_hpblade-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_hpblade-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ibmblade.pp b/pacemaker/manifests/stonith/fence_ibmblade.pp index f72cedc36..13dfe31de 100644 --- a/pacemaker/manifests/stonith/fence_ibmblade.pp +++ b/pacemaker/manifests/stonith/fence_ibmblade.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ibmblade ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_ibmblade ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ibmblade": - command => "/usr/sbin/pcs stonith delete stonith-fence_ibmblade-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ibmblade-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ibmblade-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ibmblade-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ibmblade-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ibmblade": ensure => installed, - } -> exec { - "Creating stonith::fence_ibmblade": - command => "/usr/sbin/pcs stonith create stonith-fence_ibmblade-${real_address} fence_ibmblade pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ibmblade-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ibmblade-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ibmblade-${safe_title} fence_ibmblade pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ibmblade-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ibmblade ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ibmblade-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ibmblade-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ibmblade-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_idrac.pp b/pacemaker/manifests/stonith/fence_idrac.pp index dce567db2..438c8a84f 100644 --- a/pacemaker/manifests/stonith/fence_idrac.pp +++ b/pacemaker/manifests/stonith/fence_idrac.pp @@ -1,103 +1,109 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_idrac ( - $auth = undef, - $ipaddr = undef, - $passwd = undef, - $passwd_script = undef, - $lanplus = undef, - $login = undef, - $timeout = undef, - $cipher = undef, - $method = undef, - $power_wait = undef, - $delay = undef, - $privlvl = undef, - $verbose = undef, +define pacemaker::stonith::fence_idrac ( + $auth = undef, + $ipaddr = undef, + $passwd = undef, + $passwd_script = undef, + $lanplus = undef, + $login = undef, + $timeout = undef, + $cipher = undef, + $method = undef, + $power_wait = undef, + $delay = undef, + $privlvl = undef, + $verbose = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $auth_chunk = $auth ? { + undef => "", + default => "auth=\"${auth}\"", + } + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $lanplus_chunk = $lanplus ? { + undef => "", + default => "lanplus=\"${lanplus}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $cipher_chunk = $cipher ? { + undef => "", + default => "cipher=\"${cipher}\"", + } + $method_chunk = $method ? { + undef => "", + default => "method=\"${method}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $privlvl_chunk = $privlvl ? { + undef => "", + default => "privlvl=\"${privlvl}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_idrac": - command => "/usr/sbin/pcs stonith delete stonith-fence_idrac-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_idrac-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_idrac-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_idrac-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_idrac-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $auth_chunk = $auth ? { - undef => "", - default => "auth=\"${auth}\"", - } - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $lanplus_chunk = $lanplus ? { - undef => "", - default => "lanplus=\"${lanplus}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $cipher_chunk = $cipher ? { - undef => "", - default => "cipher=\"${cipher}\"", - } - $method_chunk = $method ? { - undef => "", - default => "method=\"${method}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $privlvl_chunk = $privlvl ? { - undef => "", - default => "privlvl=\"${privlvl}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ipmilan": ensure => installed, - } -> exec { - "Creating stonith::fence_idrac": - command => "/usr/sbin/pcs stonith create stonith-fence_idrac-${real_address} fence_idrac pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_idrac-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_idrac-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_idrac-${safe_title} fence_idrac pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_idrac-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_idrac ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_idrac-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_idrac-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_idrac-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ifmib.pp b/pacemaker/manifests/stonith/fence_ifmib.pp index 2d33d98c5..a2185bc2b 100644 --- a/pacemaker/manifests/stonith/fence_ifmib.pp +++ b/pacemaker/manifests/stonith/fence_ifmib.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ifmib ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_ifmib ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ifmib": - command => "/usr/sbin/pcs stonith delete stonith-fence_ifmib-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ifmib-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ifmib-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ifmib-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ifmib-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ifmib": ensure => installed, - } -> exec { - "Creating stonith::fence_ifmib": - command => "/usr/sbin/pcs stonith create stonith-fence_ifmib-${real_address} fence_ifmib pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ifmib-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ifmib-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ifmib-${safe_title} fence_ifmib pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ifmib-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ifmib ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ifmib-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ifmib-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ifmib-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ilo.pp b/pacemaker/manifests/stonith/fence_ilo.pp index fe4297310..db495c175 100644 --- a/pacemaker/manifests/stonith/fence_ilo.pp +++ b/pacemaker/manifests/stonith/fence_ilo.pp @@ -1,138 +1,144 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ilo ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $ssl = undef, - $notls = undef, - $ribcl = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $ssl_secure = undef, - $ssl_insecure = undef, - $verbose = undef, - $debug = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_ilo ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $ssl = undef, + $notls = undef, + $ribcl = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $ssl_secure = undef, + $ssl_insecure = undef, + $verbose = undef, + $debug = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $ssl_chunk = $ssl ? { + undef => "", + default => "ssl=\"${ssl}\"", + } + $notls_chunk = $notls ? { + undef => "", + default => "notls=\"${notls}\"", + } + $ribcl_chunk = $ribcl ? { + undef => "", + default => "ribcl=\"${ribcl}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $ssl_secure_chunk = $ssl_secure ? { + undef => "", + default => "ssl_secure=\"${ssl_secure}\"", + } + $ssl_insecure_chunk = $ssl_insecure ? { + undef => "", + default => "ssl_insecure=\"${ssl_insecure}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ilo": - command => "/usr/sbin/pcs stonith delete stonith-fence_ilo-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ilo-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ilo-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $ssl_chunk = $ssl ? { - undef => "", - default => "ssl=\"${ssl}\"", - } - $notls_chunk = $notls ? { - undef => "", - default => "notls=\"${notls}\"", - } - $ribcl_chunk = $ribcl ? { - undef => "", - default => "ribcl=\"${ribcl}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $ssl_secure_chunk = $ssl_secure ? { - undef => "", - default => "ssl_secure=\"${ssl_secure}\"", - } - $ssl_insecure_chunk = $ssl_insecure ? { - undef => "", - default => "ssl_insecure=\"${ssl_insecure}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ilo2": ensure => installed, - } -> exec { - "Creating stonith::fence_ilo": - command => "/usr/sbin/pcs stonith create stonith-fence_ilo-${real_address} fence_ilo pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${ribcl_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ilo-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ilo-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ilo-${safe_title} fence_ilo pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${ribcl_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ilo-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ilo ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ilo-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ilo-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ilo-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ilo2.pp b/pacemaker/manifests/stonith/fence_ilo2.pp index 4799dc73d..644bd077f 100644 --- a/pacemaker/manifests/stonith/fence_ilo2.pp +++ b/pacemaker/manifests/stonith/fence_ilo2.pp @@ -1,138 +1,144 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ilo2 ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $ssl = undef, - $notls = undef, - $ribcl = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $ssl_secure = undef, - $ssl_insecure = undef, - $verbose = undef, - $debug = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_ilo2 ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $ssl = undef, + $notls = undef, + $ribcl = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $ssl_secure = undef, + $ssl_insecure = undef, + $verbose = undef, + $debug = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $ssl_chunk = $ssl ? { + undef => "", + default => "ssl=\"${ssl}\"", + } + $notls_chunk = $notls ? { + undef => "", + default => "notls=\"${notls}\"", + } + $ribcl_chunk = $ribcl ? { + undef => "", + default => "ribcl=\"${ribcl}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $ssl_secure_chunk = $ssl_secure ? { + undef => "", + default => "ssl_secure=\"${ssl_secure}\"", + } + $ssl_insecure_chunk = $ssl_insecure ? { + undef => "", + default => "ssl_insecure=\"${ssl_insecure}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ilo2": - command => "/usr/sbin/pcs stonith delete stonith-fence_ilo2-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo2-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ilo2-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ilo2-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo2-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $ssl_chunk = $ssl ? { - undef => "", - default => "ssl=\"${ssl}\"", - } - $notls_chunk = $notls ? { - undef => "", - default => "notls=\"${notls}\"", - } - $ribcl_chunk = $ribcl ? { - undef => "", - default => "ribcl=\"${ribcl}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $ssl_secure_chunk = $ssl_secure ? { - undef => "", - default => "ssl_secure=\"${ssl_secure}\"", - } - $ssl_insecure_chunk = $ssl_insecure ? { - undef => "", - default => "ssl_insecure=\"${ssl_insecure}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ilo2": ensure => installed, - } -> exec { - "Creating stonith::fence_ilo2": - command => "/usr/sbin/pcs stonith create stonith-fence_ilo2-${real_address} fence_ilo2 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${ribcl_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ilo2-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ilo2-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ilo2-${safe_title} fence_ilo2 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${ribcl_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ilo2-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ilo2 ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ilo2-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ilo2-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ilo2-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ilo3.pp b/pacemaker/manifests/stonith/fence_ilo3.pp index b7777cb39..b6da79e38 100644 --- a/pacemaker/manifests/stonith/fence_ilo3.pp +++ b/pacemaker/manifests/stonith/fence_ilo3.pp @@ -1,103 +1,109 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ilo3 ( - $auth = undef, - $ipaddr = undef, - $passwd = undef, - $passwd_script = undef, - $lanplus = undef, - $login = undef, - $timeout = undef, - $cipher = undef, - $method = undef, - $power_wait = undef, - $delay = undef, - $privlvl = undef, - $verbose = undef, +define pacemaker::stonith::fence_ilo3 ( + $auth = undef, + $ipaddr = undef, + $passwd = undef, + $passwd_script = undef, + $lanplus = undef, + $login = undef, + $timeout = undef, + $cipher = undef, + $method = undef, + $power_wait = undef, + $delay = undef, + $privlvl = undef, + $verbose = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $auth_chunk = $auth ? { + undef => "", + default => "auth=\"${auth}\"", + } + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $lanplus_chunk = $lanplus ? { + undef => "", + default => "lanplus=\"${lanplus}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $cipher_chunk = $cipher ? { + undef => "", + default => "cipher=\"${cipher}\"", + } + $method_chunk = $method ? { + undef => "", + default => "method=\"${method}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $privlvl_chunk = $privlvl ? { + undef => "", + default => "privlvl=\"${privlvl}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ilo3": - command => "/usr/sbin/pcs stonith delete stonith-fence_ilo3-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo3-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ilo3-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ilo3-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo3-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $auth_chunk = $auth ? { - undef => "", - default => "auth=\"${auth}\"", - } - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $lanplus_chunk = $lanplus ? { - undef => "", - default => "lanplus=\"${lanplus}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $cipher_chunk = $cipher ? { - undef => "", - default => "cipher=\"${cipher}\"", - } - $method_chunk = $method ? { - undef => "", - default => "method=\"${method}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $privlvl_chunk = $privlvl ? { - undef => "", - default => "privlvl=\"${privlvl}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ipmilan": ensure => installed, - } -> exec { - "Creating stonith::fence_ilo3": - command => "/usr/sbin/pcs stonith create stonith-fence_ilo3-${real_address} fence_ilo3 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ilo3-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ilo3-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ilo3-${safe_title} fence_ilo3 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ilo3-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ilo3 ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ilo3-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ilo3-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ilo3-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ilo4.pp b/pacemaker/manifests/stonith/fence_ilo4.pp index 3b1da970e..714b3cf10 100644 --- a/pacemaker/manifests/stonith/fence_ilo4.pp +++ b/pacemaker/manifests/stonith/fence_ilo4.pp @@ -1,103 +1,109 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ilo4 ( - $auth = undef, - $ipaddr = undef, - $passwd = undef, - $passwd_script = undef, - $lanplus = undef, - $login = undef, - $timeout = undef, - $cipher = undef, - $method = undef, - $power_wait = undef, - $delay = undef, - $privlvl = undef, - $verbose = undef, +define pacemaker::stonith::fence_ilo4 ( + $auth = undef, + $ipaddr = undef, + $passwd = undef, + $passwd_script = undef, + $lanplus = undef, + $login = undef, + $timeout = undef, + $cipher = undef, + $method = undef, + $power_wait = undef, + $delay = undef, + $privlvl = undef, + $verbose = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $auth_chunk = $auth ? { + undef => "", + default => "auth=\"${auth}\"", + } + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $lanplus_chunk = $lanplus ? { + undef => "", + default => "lanplus=\"${lanplus}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $cipher_chunk = $cipher ? { + undef => "", + default => "cipher=\"${cipher}\"", + } + $method_chunk = $method ? { + undef => "", + default => "method=\"${method}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $privlvl_chunk = $privlvl ? { + undef => "", + default => "privlvl=\"${privlvl}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ilo4": - command => "/usr/sbin/pcs stonith delete stonith-fence_ilo4-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo4-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ilo4-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ilo4-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo4-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $auth_chunk = $auth ? { - undef => "", - default => "auth=\"${auth}\"", - } - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $lanplus_chunk = $lanplus ? { - undef => "", - default => "lanplus=\"${lanplus}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $cipher_chunk = $cipher ? { - undef => "", - default => "cipher=\"${cipher}\"", - } - $method_chunk = $method ? { - undef => "", - default => "method=\"${method}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $privlvl_chunk = $privlvl ? { - undef => "", - default => "privlvl=\"${privlvl}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ipmilan": ensure => installed, - } -> exec { - "Creating stonith::fence_ilo4": - command => "/usr/sbin/pcs stonith create stonith-fence_ilo4-${real_address} fence_ilo4 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ilo4-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ilo4-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ilo4-${safe_title} fence_ilo4 pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ilo4-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ilo4 ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ilo4-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ilo4-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ilo4-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ilo_mp.pp b/pacemaker/manifests/stonith/fence_ilo_mp.pp index 661a70e85..6b8e30d1c 100644 --- a/pacemaker/manifests/stonith/fence_ilo_mp.pp +++ b/pacemaker/manifests/stonith/fence_ilo_mp.pp @@ -1,133 +1,139 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ilo_mp ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $secure = undef, - $cmd_prompt = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_ilo_mp ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $secure = undef, + $cmd_prompt = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ilo_mp": - command => "/usr/sbin/pcs stonith delete stonith-fence_ilo_mp-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo_mp-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ilo_mp-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ilo_mp-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ilo_mp-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ilo-mp": ensure => installed, - } -> exec { - "Creating stonith::fence_ilo_mp": - command => "/usr/sbin/pcs stonith create stonith-fence_ilo_mp-${real_address} fence_ilo_mp pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${secure_chunk} ${cmd_prompt_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ilo_mp-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ilo_mp-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ilo_mp-${safe_title} fence_ilo_mp pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${secure_chunk} ${cmd_prompt_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ilo_mp-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ilo_mp ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ilo_mp-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ilo_mp-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ilo_mp-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_imm.pp b/pacemaker/manifests/stonith/fence_imm.pp index 993556c5a..d4534b4e9 100644 --- a/pacemaker/manifests/stonith/fence_imm.pp +++ b/pacemaker/manifests/stonith/fence_imm.pp @@ -1,103 +1,109 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_imm ( - $auth = undef, - $ipaddr = undef, - $passwd = undef, - $passwd_script = undef, - $lanplus = undef, - $login = undef, - $timeout = undef, - $cipher = undef, - $method = undef, - $power_wait = undef, - $delay = undef, - $privlvl = undef, - $verbose = undef, +define pacemaker::stonith::fence_imm ( + $auth = undef, + $ipaddr = undef, + $passwd = undef, + $passwd_script = undef, + $lanplus = undef, + $login = undef, + $timeout = undef, + $cipher = undef, + $method = undef, + $power_wait = undef, + $delay = undef, + $privlvl = undef, + $verbose = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $auth_chunk = $auth ? { + undef => "", + default => "auth=\"${auth}\"", + } + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $lanplus_chunk = $lanplus ? { + undef => "", + default => "lanplus=\"${lanplus}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $cipher_chunk = $cipher ? { + undef => "", + default => "cipher=\"${cipher}\"", + } + $method_chunk = $method ? { + undef => "", + default => "method=\"${method}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $privlvl_chunk = $privlvl ? { + undef => "", + default => "privlvl=\"${privlvl}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_imm": - command => "/usr/sbin/pcs stonith delete stonith-fence_imm-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_imm-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_imm-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_imm-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_imm-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $auth_chunk = $auth ? { - undef => "", - default => "auth=\"${auth}\"", - } - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $lanplus_chunk = $lanplus ? { - undef => "", - default => "lanplus=\"${lanplus}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $cipher_chunk = $cipher ? { - undef => "", - default => "cipher=\"${cipher}\"", - } - $method_chunk = $method ? { - undef => "", - default => "method=\"${method}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $privlvl_chunk = $privlvl ? { - undef => "", - default => "privlvl=\"${privlvl}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ipmilan": ensure => installed, - } -> exec { - "Creating stonith::fence_imm": - command => "/usr/sbin/pcs stonith create stonith-fence_imm-${real_address} fence_imm pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_imm-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_imm-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_imm-${safe_title} fence_imm pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_imm-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_imm ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_imm-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_imm-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_imm-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_intelmodular.pp b/pacemaker/manifests/stonith/fence_intelmodular.pp index bde84bafd..b93a5f40d 100644 --- a/pacemaker/manifests/stonith/fence_intelmodular.pp +++ b/pacemaker/manifests/stonith/fence_intelmodular.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_intelmodular ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_intelmodular ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_intelmodular": - command => "/usr/sbin/pcs stonith delete stonith-fence_intelmodular-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_intelmodular-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_intelmodular-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_intelmodular-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_intelmodular-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-intelmodular": ensure => installed, - } -> exec { - "Creating stonith::fence_intelmodular": - command => "/usr/sbin/pcs stonith create stonith-fence_intelmodular-${real_address} fence_intelmodular pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_intelmodular-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_intelmodular-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_intelmodular-${safe_title} fence_intelmodular pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_intelmodular-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_intelmodular ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_intelmodular-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_intelmodular-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_intelmodular-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ipdu.pp b/pacemaker/manifests/stonith/fence_ipdu.pp index 7dbd3a598..53aa32a8b 100644 --- a/pacemaker/manifests/stonith/fence_ipdu.pp +++ b/pacemaker/manifests/stonith/fence_ipdu.pp @@ -1,158 +1,164 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ipdu ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $port = undef, - $snmp_version = undef, - $community = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $snmp_auth_prot = undef, - $snmp_sec_level = undef, - $snmp_priv_prot = undef, - $snmp_priv_passwd = undef, - $snmp_priv_passwd_script = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_ipdu ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $port = undef, + $snmp_version = undef, + $community = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $snmp_auth_prot = undef, + $snmp_sec_level = undef, + $snmp_priv_prot = undef, + $snmp_priv_passwd = undef, + $snmp_priv_passwd_script = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $snmp_version_chunk = $snmp_version ? { + undef => "", + default => "snmp_version=\"${snmp_version}\"", + } + $community_chunk = $community ? { + undef => "", + default => "community=\"${community}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $snmp_auth_prot_chunk = $snmp_auth_prot ? { + undef => "", + default => "snmp_auth_prot=\"${snmp_auth_prot}\"", + } + $snmp_sec_level_chunk = $snmp_sec_level ? { + undef => "", + default => "snmp_sec_level=\"${snmp_sec_level}\"", + } + $snmp_priv_prot_chunk = $snmp_priv_prot ? { + undef => "", + default => "snmp_priv_prot=\"${snmp_priv_prot}\"", + } + $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { + undef => "", + default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", + } + $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { + undef => "", + default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ipdu": - command => "/usr/sbin/pcs stonith delete stonith-fence_ipdu-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ipdu-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ipdu-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ipdu-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ipdu-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $snmp_version_chunk = $snmp_version ? { - undef => "", - default => "snmp_version=\"${snmp_version}\"", - } - $community_chunk = $community ? { - undef => "", - default => "community=\"${community}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $snmp_auth_prot_chunk = $snmp_auth_prot ? { - undef => "", - default => "snmp_auth_prot=\"${snmp_auth_prot}\"", - } - $snmp_sec_level_chunk = $snmp_sec_level ? { - undef => "", - default => "snmp_sec_level=\"${snmp_sec_level}\"", - } - $snmp_priv_prot_chunk = $snmp_priv_prot ? { - undef => "", - default => "snmp_priv_prot=\"${snmp_priv_prot}\"", - } - $snmp_priv_passwd_chunk = $snmp_priv_passwd ? { - undef => "", - default => "snmp_priv_passwd=\"${snmp_priv_passwd}\"", - } - $snmp_priv_passwd_script_chunk = $snmp_priv_passwd_script ? { - undef => "", - default => "snmp_priv_passwd_script=\"${snmp_priv_passwd_script}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ipdu": ensure => installed, - } -> exec { - "Creating stonith::fence_ipdu": - command => "/usr/sbin/pcs stonith create stonith-fence_ipdu-${real_address} fence_ipdu pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ipdu-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ipdu-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ipdu-${safe_title} fence_ipdu pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${port_chunk} ${snmp_version_chunk} ${community_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${snmp_auth_prot_chunk} ${snmp_sec_level_chunk} ${snmp_priv_prot_chunk} ${snmp_priv_passwd_chunk} ${snmp_priv_passwd_script_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ipdu-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ipdu ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ipdu-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ipdu-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ipdu-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_ipmilan.pp b/pacemaker/manifests/stonith/fence_ipmilan.pp index c143d5820..6183519df 100644 --- a/pacemaker/manifests/stonith/fence_ipmilan.pp +++ b/pacemaker/manifests/stonith/fence_ipmilan.pp @@ -1,103 +1,109 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_ipmilan ( - $auth = undef, - $ipaddr = undef, - $passwd = undef, - $passwd_script = undef, - $lanplus = undef, - $login = undef, - $timeout = undef, - $cipher = undef, - $method = undef, - $power_wait = undef, - $delay = undef, - $privlvl = undef, - $verbose = undef, +define pacemaker::stonith::fence_ipmilan ( + $auth = undef, + $ipaddr = undef, + $passwd = undef, + $passwd_script = undef, + $lanplus = undef, + $login = undef, + $timeout = undef, + $cipher = undef, + $method = undef, + $power_wait = undef, + $delay = undef, + $privlvl = undef, + $verbose = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $auth_chunk = $auth ? { + undef => "", + default => "auth=\"${auth}\"", + } + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $lanplus_chunk = $lanplus ? { + undef => "", + default => "lanplus=\"${lanplus}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $cipher_chunk = $cipher ? { + undef => "", + default => "cipher=\"${cipher}\"", + } + $method_chunk = $method ? { + undef => "", + default => "method=\"${method}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $privlvl_chunk = $privlvl ? { + undef => "", + default => "privlvl=\"${privlvl}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_ipmilan": - command => "/usr/sbin/pcs stonith delete stonith-fence_ipmilan-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_ipmilan-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_ipmilan-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_ipmilan-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_ipmilan-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $auth_chunk = $auth ? { - undef => "", - default => "auth=\"${auth}\"", - } - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $lanplus_chunk = $lanplus ? { - undef => "", - default => "lanplus=\"${lanplus}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $cipher_chunk = $cipher ? { - undef => "", - default => "cipher=\"${cipher}\"", - } - $method_chunk = $method ? { - undef => "", - default => "method=\"${method}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $privlvl_chunk = $privlvl ? { - undef => "", - default => "privlvl=\"${privlvl}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-ipmilan": ensure => installed, - } -> exec { - "Creating stonith::fence_ipmilan": - command => "/usr/sbin/pcs stonith create stonith-fence_ipmilan-${real_address} fence_ipmilan pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_ipmilan-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_ipmilan-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_ipmilan-${safe_title} fence_ipmilan pcmk_host_list=\"${pcmk_host_value_chunk}\" ${auth_chunk} ${ipaddr_chunk} ${passwd_chunk} ${passwd_script_chunk} ${lanplus_chunk} ${login_chunk} ${timeout_chunk} ${cipher_chunk} ${method_chunk} ${power_wait_chunk} ${delay_chunk} ${privlvl_chunk} ${verbose_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_ipmilan-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_ipmilan ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_ipmilan-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_ipmilan-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_ipmilan-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_kdump.pp b/pacemaker/manifests/stonith/fence_kdump.pp index dda1a83f8..4d8936427 100644 --- a/pacemaker/manifests/stonith/fence_kdump.pp +++ b/pacemaker/manifests/stonith/fence_kdump.pp @@ -1,68 +1,74 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_kdump ( - $nodename = undef, - $ipport = undef, - $family = undef, - $timeout = undef, - $verbose = undef, - $usage = undef, +define pacemaker::stonith::fence_kdump ( + $nodename = undef, + $ipport = undef, + $family = undef, + $timeout = undef, + $verbose = undef, + $usage = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $nodename_chunk = $nodename ? { + undef => "", + default => "nodename=\"${nodename}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $family_chunk = $family ? { + undef => "", + default => "family=\"${family}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $usage_chunk = $usage ? { + undef => "", + default => "usage=\"${usage}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_kdump": - command => "/usr/sbin/pcs stonith delete stonith-fence_kdump-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_kdump-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_kdump-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_kdump-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_kdump-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $nodename_chunk = $nodename ? { - undef => "", - default => "nodename=\"${nodename}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $family_chunk = $family ? { - undef => "", - default => "family=\"${family}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $usage_chunk = $usage ? { - undef => "", - default => "usage=\"${usage}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-kdump": ensure => installed, - } -> exec { - "Creating stonith::fence_kdump": - command => "/usr/sbin/pcs stonith create stonith-fence_kdump-${real_address} fence_kdump pcmk_host_list=\"${pcmk_host_value_chunk}\" ${nodename_chunk} ${ipport_chunk} ${family_chunk} ${timeout_chunk} ${verbose_chunk} ${usage_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_kdump-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_kdump-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_kdump-${safe_title} fence_kdump pcmk_host_list=\"${pcmk_host_value_chunk}\" ${nodename_chunk} ${ipport_chunk} ${family_chunk} ${timeout_chunk} ${verbose_chunk} ${usage_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_kdump-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_kdump ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_kdump-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_kdump-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_kdump-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_rhevm.pp b/pacemaker/manifests/stonith/fence_rhevm.pp index 9b31530c0..669fa1db8 100644 --- a/pacemaker/manifests/stonith/fence_rhevm.pp +++ b/pacemaker/manifests/stonith/fence_rhevm.pp @@ -1,143 +1,149 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_rhevm ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $ssl = undef, - $notls = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $ssl_secure = undef, - $ssl_insecure = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_rhevm ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $ssl = undef, + $notls = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $ssl_secure = undef, + $ssl_insecure = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $ssl_chunk = $ssl ? { + undef => "", + default => "ssl=\"${ssl}\"", + } + $notls_chunk = $notls ? { + undef => "", + default => "notls=\"${notls}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $ssl_secure_chunk = $ssl_secure ? { + undef => "", + default => "ssl_secure=\"${ssl_secure}\"", + } + $ssl_insecure_chunk = $ssl_insecure ? { + undef => "", + default => "ssl_insecure=\"${ssl_insecure}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_rhevm": - command => "/usr/sbin/pcs stonith delete stonith-fence_rhevm-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_rhevm-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_rhevm-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_rhevm-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_rhevm-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $ssl_chunk = $ssl ? { - undef => "", - default => "ssl=\"${ssl}\"", - } - $notls_chunk = $notls ? { - undef => "", - default => "notls=\"${notls}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $ssl_secure_chunk = $ssl_secure ? { - undef => "", - default => "ssl_secure=\"${ssl_secure}\"", - } - $ssl_insecure_chunk = $ssl_insecure ? { - undef => "", - default => "ssl_insecure=\"${ssl_insecure}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-rhevm": ensure => installed, - } -> exec { - "Creating stonith::fence_rhevm": - command => "/usr/sbin/pcs stonith create stonith-fence_rhevm-${real_address} fence_rhevm pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_rhevm-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_rhevm-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_rhevm-${safe_title} fence_rhevm pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_rhevm-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_rhevm ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_rhevm-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_rhevm-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_rhevm-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_rsb.pp b/pacemaker/manifests/stonith/fence_rsb.pp index 879799a52..0ff8475a3 100644 --- a/pacemaker/manifests/stonith/fence_rsb.pp +++ b/pacemaker/manifests/stonith/fence_rsb.pp @@ -1,133 +1,139 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_rsb ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $secure = undef, - $cmd_prompt = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_rsb ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $secure = undef, + $cmd_prompt = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_rsb": - command => "/usr/sbin/pcs stonith delete stonith-fence_rsb-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_rsb-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_rsb-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_rsb-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_rsb-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-rsb": ensure => installed, - } -> exec { - "Creating stonith::fence_rsb": - command => "/usr/sbin/pcs stonith create stonith-fence_rsb-${real_address} fence_rsb pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${secure_chunk} ${cmd_prompt_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_rsb-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_rsb-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_rsb-${safe_title} fence_rsb pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${secure_chunk} ${cmd_prompt_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_rsb-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_rsb ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_rsb-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_rsb-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_rsb-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_scsi.pp b/pacemaker/manifests/stonith/fence_scsi.pp index 52032dde2..3031da94f 100644 --- a/pacemaker/manifests/stonith/fence_scsi.pp +++ b/pacemaker/manifests/stonith/fence_scsi.pp @@ -1,68 +1,74 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_scsi ( - $aptpl = undef, - $devices = undef, - $logfile = undef, - $delay = undef, - $key = undef, - $nodename = undef, +define pacemaker::stonith::fence_scsi ( + $aptpl = undef, + $devices = undef, + $logfile = undef, + $delay = undef, + $key = undef, + $nodename = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $aptpl_chunk = $aptpl ? { + undef => "", + default => "aptpl=\"${aptpl}\"", + } + $devices_chunk = $devices ? { + undef => "", + default => "devices=\"${devices}\"", + } + $logfile_chunk = $logfile ? { + undef => "", + default => "logfile=\"${logfile}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $key_chunk = $key ? { + undef => "", + default => "key=\"${key}\"", + } + $nodename_chunk = $nodename ? { + undef => "", + default => "nodename=\"${nodename}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_scsi": - command => "/usr/sbin/pcs stonith delete stonith-fence_scsi-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_scsi-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_scsi-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_scsi-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_scsi-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $aptpl_chunk = $aptpl ? { - undef => "", - default => "aptpl=\"${aptpl}\"", - } - $devices_chunk = $devices ? { - undef => "", - default => "devices=\"${devices}\"", - } - $logfile_chunk = $logfile ? { - undef => "", - default => "logfile=\"${logfile}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $key_chunk = $key ? { - undef => "", - default => "key=\"${key}\"", - } - $nodename_chunk = $nodename ? { - undef => "", - default => "nodename=\"${nodename}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-scsi": ensure => installed, - } -> exec { - "Creating stonith::fence_scsi": - command => "/usr/sbin/pcs stonith create stonith-fence_scsi-${real_address} fence_scsi pcmk_host_list=\"${pcmk_host_value_chunk}\" ${aptpl_chunk} ${devices_chunk} ${logfile_chunk} ${delay_chunk} ${key_chunk} ${nodename_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_scsi-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_scsi-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_scsi-${safe_title} fence_scsi pcmk_host_list=\"${pcmk_host_value_chunk}\" ${aptpl_chunk} ${devices_chunk} ${logfile_chunk} ${delay_chunk} ${key_chunk} ${nodename_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_scsi-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_scsi ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_scsi-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_scsi-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_scsi-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_virt.pp b/pacemaker/manifests/stonith/fence_virt.pp index d948a58a1..ef9c3b2fb 100644 --- a/pacemaker/manifests/stonith/fence_virt.pp +++ b/pacemaker/manifests/stonith/fence_virt.pp @@ -1,83 +1,89 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_virt ( - $debug = undef, - $serial_device = undef, - $serial_params = undef, - $channel_address = undef, - $ipport = undef, - $port = undef, - $timeout = undef, - $delay = undef, - $domain = undef, +define pacemaker::stonith::fence_virt ( + $debug = undef, + $serial_device = undef, + $serial_params = undef, + $channel_address = undef, + $ipport = undef, + $port = undef, + $timeout = undef, + $delay = undef, + $domain = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $serial_device_chunk = $serial_device ? { + undef => "", + default => "serial_device=\"${serial_device}\"", + } + $serial_params_chunk = $serial_params ? { + undef => "", + default => "serial_params=\"${serial_params}\"", + } + $channel_address_chunk = $channel_address ? { + undef => "", + default => "channel_address=\"${channel_address}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $domain_chunk = $domain ? { + undef => "", + default => "domain=\"${domain}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_virt": - command => "/usr/sbin/pcs stonith delete stonith-fence_virt-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_virt-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_virt-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_virt-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_virt-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $serial_device_chunk = $serial_device ? { - undef => "", - default => "serial_device=\"${serial_device}\"", - } - $serial_params_chunk = $serial_params ? { - undef => "", - default => "serial_params=\"${serial_params}\"", - } - $channel_address_chunk = $channel_address ? { - undef => "", - default => "channel_address=\"${channel_address}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $timeout_chunk = $timeout ? { - undef => "", - default => "timeout=\"${timeout}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $domain_chunk = $domain ? { - undef => "", - default => "domain=\"${domain}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-virt": ensure => installed, - } -> exec { - "Creating stonith::fence_virt": - command => "/usr/sbin/pcs stonith create stonith-fence_virt-${real_address} fence_virt pcmk_host_list=\"${pcmk_host_value_chunk}\" ${debug_chunk} ${serial_device_chunk} ${serial_params_chunk} ${channel_address_chunk} ${ipport_chunk} ${port_chunk} ${timeout_chunk} ${delay_chunk} ${domain_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_virt-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_virt-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_virt-${safe_title} fence_virt pcmk_host_list=\"${pcmk_host_value_chunk}\" ${debug_chunk} ${serial_device_chunk} ${serial_params_chunk} ${channel_address_chunk} ${ipport_chunk} ${port_chunk} ${timeout_chunk} ${delay_chunk} ${domain_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_virt-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_virt ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_virt-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_virt-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_virt-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_vmware_soap.pp b/pacemaker/manifests/stonith/fence_vmware_soap.pp index 47c6cedc8..e5021169e 100644 --- a/pacemaker/manifests/stonith/fence_vmware_soap.pp +++ b/pacemaker/manifests/stonith/fence_vmware_soap.pp @@ -1,143 +1,149 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_vmware_soap ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $ssl = undef, - $notls = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $ssl_secure = undef, - $ssl_insecure = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_vmware_soap ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $ssl = undef, + $notls = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $ssl_secure = undef, + $ssl_insecure = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $ssl_chunk = $ssl ? { + undef => "", + default => "ssl=\"${ssl}\"", + } + $notls_chunk = $notls ? { + undef => "", + default => "notls=\"${notls}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $ssl_secure_chunk = $ssl_secure ? { + undef => "", + default => "ssl_secure=\"${ssl_secure}\"", + } + $ssl_insecure_chunk = $ssl_insecure ? { + undef => "", + default => "ssl_insecure=\"${ssl_insecure}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_vmware_soap": - command => "/usr/sbin/pcs stonith delete stonith-fence_vmware_soap-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_vmware_soap-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_vmware_soap-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_vmware_soap-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_vmware_soap-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $ssl_chunk = $ssl ? { - undef => "", - default => "ssl=\"${ssl}\"", - } - $notls_chunk = $notls ? { - undef => "", - default => "notls=\"${notls}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $ssl_secure_chunk = $ssl_secure ? { - undef => "", - default => "ssl_secure=\"${ssl_secure}\"", - } - $ssl_insecure_chunk = $ssl_insecure ? { - undef => "", - default => "ssl_insecure=\"${ssl_insecure}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-vmware-soap": ensure => installed, - } -> exec { - "Creating stonith::fence_vmware_soap": - command => "/usr/sbin/pcs stonith create stonith-fence_vmware_soap-${real_address} fence_vmware_soap pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_vmware_soap-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_vmware_soap-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_vmware_soap-${safe_title} fence_vmware_soap pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${ssl_chunk} ${notls_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${ssl_secure_chunk} ${ssl_insecure_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_vmware_soap-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_vmware_soap ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_vmware_soap-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_vmware_soap-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_vmware_soap-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_wti.pp b/pacemaker/manifests/stonith/fence_wti.pp index 14b346fbd..1cfb21752 100644 --- a/pacemaker/manifests/stonith/fence_wti.pp +++ b/pacemaker/manifests/stonith/fence_wti.pp @@ -1,143 +1,149 @@ # generated by agent_generator.rb, manual changes will be lost -class pacemaker::stonith::fence_wti ( - $ipaddr = undef, - $login = undef, - $passwd = undef, - $cmd_prompt = undef, - $secure = undef, - $port = undef, - $ipport = undef, - $inet4_only = undef, - $inet6_only = undef, - $passwd_script = undef, - $identity_file = undef, - $ssh_options = undef, - $verbose = undef, - $debug = undef, - $separator = undef, - $power_timeout = undef, - $shell_timeout = undef, - $login_timeout = undef, - $power_wait = undef, - $delay = undef, - $retry_on = undef, +define pacemaker::stonith::fence_wti ( + $ipaddr = undef, + $login = undef, + $passwd = undef, + $cmd_prompt = undef, + $secure = undef, + $port = undef, + $ipport = undef, + $inet4_only = undef, + $inet6_only = undef, + $passwd_script = undef, + $identity_file = undef, + $ssh_options = undef, + $verbose = undef, + $debug = undef, + $separator = undef, + $power_timeout = undef, + $shell_timeout = undef, + $login_timeout = undef, + $power_wait = undef, + $delay = undef, + $retry_on = undef, - $interval = "60s", - $ensure = present, - $pcmk_host_value = undef, + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, + $tries = undef, + $try_sleep = undef, ) { - $real_address = "$(corosync-cfgtool -a $(crm_node -n))" + $ipaddr_chunk = $ipaddr ? { + undef => "", + default => "ipaddr=\"${ipaddr}\"", + } + $login_chunk = $login ? { + undef => "", + default => "login=\"${login}\"", + } + $passwd_chunk = $passwd ? { + undef => "", + default => "passwd=\"${passwd}\"", + } + $cmd_prompt_chunk = $cmd_prompt ? { + undef => "", + default => "cmd_prompt=\"${cmd_prompt}\"", + } + $secure_chunk = $secure ? { + undef => "", + default => "secure=\"${secure}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $inet4_only_chunk = $inet4_only ? { + undef => "", + default => "inet4_only=\"${inet4_only}\"", + } + $inet6_only_chunk = $inet6_only ? { + undef => "", + default => "inet6_only=\"${inet6_only}\"", + } + $passwd_script_chunk = $passwd_script ? { + undef => "", + default => "passwd_script=\"${passwd_script}\"", + } + $identity_file_chunk = $identity_file ? { + undef => "", + default => "identity_file=\"${identity_file}\"", + } + $ssh_options_chunk = $ssh_options ? { + undef => "", + default => "ssh_options=\"${ssh_options}\"", + } + $verbose_chunk = $verbose ? { + undef => "", + default => "verbose=\"${verbose}\"", + } + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $separator_chunk = $separator ? { + undef => "", + default => "separator=\"${separator}\"", + } + $power_timeout_chunk = $power_timeout ? { + undef => "", + default => "power_timeout=\"${power_timeout}\"", + } + $shell_timeout_chunk = $shell_timeout ? { + undef => "", + default => "shell_timeout=\"${shell_timeout}\"", + } + $login_timeout_chunk = $login_timeout ? { + undef => "", + default => "login_timeout=\"${login_timeout}\"", + } + $power_wait_chunk = $power_wait ? { + undef => "", + default => "power_wait=\"${power_wait}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $retry_on_chunk = $retry_on ? { + undef => "", + default => "retry_on=\"${retry_on}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { - "Removing stonith::fence_wti": - command => "/usr/sbin/pcs stonith delete stonith-fence_wti-${real_address}", - onlyif => "/usr/sbin/pcs stonith show stonith-fence_wti-${real_address} > /dev/null 2>&1", + exec { "Delete stonith-fence_wti-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_wti-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_wti-${safe_title} > /dev/null 2>&1", require => Class["pacemaker::corosync"], } } else { - $ipaddr_chunk = $ipaddr ? { - undef => "", - default => "ipaddr=\"${ipaddr}\"", - } - $login_chunk = $login ? { - undef => "", - default => "login=\"${login}\"", - } - $passwd_chunk = $passwd ? { - undef => "", - default => "passwd=\"${passwd}\"", - } - $cmd_prompt_chunk = $cmd_prompt ? { - undef => "", - default => "cmd_prompt=\"${cmd_prompt}\"", - } - $secure_chunk = $secure ? { - undef => "", - default => "secure=\"${secure}\"", - } - $port_chunk = $port ? { - undef => "", - default => "port=\"${port}\"", - } - $ipport_chunk = $ipport ? { - undef => "", - default => "ipport=\"${ipport}\"", - } - $inet4_only_chunk = $inet4_only ? { - undef => "", - default => "inet4_only=\"${inet4_only}\"", - } - $inet6_only_chunk = $inet6_only ? { - undef => "", - default => "inet6_only=\"${inet6_only}\"", - } - $passwd_script_chunk = $passwd_script ? { - undef => "", - default => "passwd_script=\"${passwd_script}\"", - } - $identity_file_chunk = $identity_file ? { - undef => "", - default => "identity_file=\"${identity_file}\"", - } - $ssh_options_chunk = $ssh_options ? { - undef => "", - default => "ssh_options=\"${ssh_options}\"", - } - $verbose_chunk = $verbose ? { - undef => "", - default => "verbose=\"${verbose}\"", - } - $debug_chunk = $debug ? { - undef => "", - default => "debug=\"${debug}\"", - } - $separator_chunk = $separator ? { - undef => "", - default => "separator=\"${separator}\"", - } - $power_timeout_chunk = $power_timeout ? { - undef => "", - default => "power_timeout=\"${power_timeout}\"", - } - $shell_timeout_chunk = $shell_timeout ? { - undef => "", - default => "shell_timeout=\"${shell_timeout}\"", - } - $login_timeout_chunk = $login_timeout ? { - undef => "", - default => "login_timeout=\"${login_timeout}\"", - } - $power_wait_chunk = $power_wait ? { - undef => "", - default => "power_wait=\"${power_wait}\"", - } - $delay_chunk = $delay ? { - undef => "", - default => "delay=\"${delay}\"", - } - $retry_on_chunk = $retry_on ? { - undef => "", - default => "retry_on=\"${retry_on}\"", - } - - $pcmk_host_value_chunk = $pcmk_host_list ? { - '' => '$(/usr/sbin/crm_node -n)', - default => "${pcmk_host_list}", - } - package { "fence-agents-wti": ensure => installed, - } -> exec { - "Creating stonith::fence_wti": - command => "/usr/sbin/pcs stonith create stonith-fence_wti-${real_address} fence_wti pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-fence_wti-${real_address} > /dev/null 2>&1", + } -> + exec { "Create stonith-fence_wti-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_wti-${safe_title} fence_wti pcmk_host_list=\"${pcmk_host_value_chunk}\" ${ipaddr_chunk} ${login_chunk} ${passwd_chunk} ${cmd_prompt_chunk} ${secure_chunk} ${port_chunk} ${ipport_chunk} ${inet4_only_chunk} ${inet6_only_chunk} ${passwd_script_chunk} ${identity_file_chunk} ${ssh_options_chunk} ${verbose_chunk} ${debug_chunk} ${separator_chunk} ${power_timeout_chunk} ${shell_timeout_chunk} ${login_timeout_chunk} ${power_wait_chunk} ${delay_chunk} ${retry_on_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_wti-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, require => Class["pacemaker::corosync"], - } -> exec { - "Adding non-local constraint stonith::fence_wti ${real_address}": - command => "/usr/sbin/pcs constraint location stonith-fence_wti-${real_address} avoids ${pcmk_host_value_chunk}" + } -> + exec { "Add non-local constraint for stonith-fence_wti-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_wti-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } } diff --git a/pacemaker/manifests/stonith/fence_xvm.pp b/pacemaker/manifests/stonith/fence_xvm.pp index d0bdb9d8a..cba974c7b 100644 --- a/pacemaker/manifests/stonith/fence_xvm.pp +++ b/pacemaker/manifests/stonith/fence_xvm.pp @@ -1,42 +1,104 @@ -# DEPRECATED: use pacemaker::stonith::xvm instead +define pacemaker::stonith::fence_xvm ( + $debug = undef, + $ip_family = undef, + $multicast_address = undef, + $ipport = undef, + $retrans = undef, + $auth = undef, + $hash = undef, + $key_file = undef, + $port = undef, + $use_uuid = undef, + $timeout = undef, + $delay = undef, + $domain = undef, -# To use this class ensure that fence_virtd is properly configured and running on the hypervisor + $interval = "60s", + $ensure = present, + $pcmk_host_list = undef, -class pacemaker::stonith::fence_xvm( - $name, - $manage_key_file=false, - $key_file="/etc/cluster/fence_xvm.key", - $key_file_password="123456", - $interval="30s", - $ensure=present, - $port=undef, # the name of the vm - $pcmk_host=undef, # the hostname or IP that pacemaker uses + $manage_key_file = false, + $key_file = "/etc/cluster/fence_xvm.key", + $key_file_password = "123456", $manage_fw = true, - ) { - warning('pacemaker::stonith::fence_xvm is deprecated, use pacemaker::stonith::xvm instead') + $tries = undef, + $try_sleep = undef, +) { + $debug_chunk = $debug ? { + undef => "", + default => "debug=\"${debug}\"", + } + $ip_family_chunk = $ip_family ? { + undef => "", + default => "ip_family=\"${ip_family}\"", + } + $multicast_address_chunk = $multicast_address ? { + undef => "", + default => "multicast_address=\"${multicast_address}\"", + } + $ipport_chunk = $ipport ? { + undef => "", + default => "ipport=\"${ipport}\"", + } + $retrans_chunk = $retrans ? { + undef => "", + default => "retrans=\"${retrans}\"", + } + $auth_chunk = $auth ? { + undef => "", + default => "auth=\"${auth}\"", + } + $hash_chunk = $hash ? { + undef => "", + default => "hash=\"${hash}\"", + } + $key_file_chunk = $key_file ? { + undef => "", + default => "key_file=\"${key_file}\"", + } + $port_chunk = $port ? { + undef => "", + default => "port=\"${port}\"", + } + $use_uuid_chunk = $use_uuid ? { + undef => "", + default => "use_uuid=\"${use_uuid}\"", + } + $timeout_chunk = $timeout ? { + undef => "", + default => "timeout=\"${timeout}\"", + } + $delay_chunk = $delay ? { + undef => "", + default => "delay=\"${delay}\"", + } + $domain_chunk = $domain ? { + undef => "", + default => "domain=\"${domain}\"", + } + + $pcmk_host_value_chunk = $pcmk_host_list ? { + undef => '$(/usr/sbin/crm_node -n)', + default => "${pcmk_host_list}", + } + + # $title can be a mac address, remove the colons for pcmk resource name + $safe_title = regsubst($title, ':', '', 'G') if($ensure == absent) { - exec { "Removing stonith::fence_xvm ${name}": - command => "/usr/sbin/pcs stonith delete fence_xvm-${name }", - onlyif => "/usr/sbin/pcs stonith show fence_xvm-${name} > /dev/null 2>&1", - require => Class['pacemaker::corosync'], + exec { "Delete stonith-fence_xvm-${safe_title}": + command => "/usr/sbin/pcs stonith delete stonith-fence_xvm-${safe_title}", + onlyif => "/usr/sbin/pcs stonith show stonith-fence_xvm-${safe_title} > /dev/null 2>&1", + require => Class["pacemaker::corosync"], } } else { - $port_chunk = $port ? { - '' => '', - default => "port=${port}", - } - $pcmk_host_list_chunk = $pcmk_host ? { - '' => 'pcmk_host_list=$(/usr/sbin/crm_node -n)', - default => "pcmk_host_list=${pcmk_host}", - } - if $manage_key_file { + if str2bool($manage_key_file) { file { "$key_file": content => "$key_file_password", } } - if $manage_fw { + if str2bool($manage_fw) { firewall { "003 fence_xvm": proto => 'igmp', action => 'accept', @@ -53,10 +115,20 @@ } } - exec { "Creating stonith::fence_xvm ${name}": - command => "/usr/sbin/pcs stonith create fence_xvm-${name} fence_xvm ${port_chunk} ${pcmk_host_list_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show fence_xvm-${name} > /dev/null 2>&1", - require => Class['pacemaker::corosync'], + package { + "fence-virt": ensure => installed, + } -> + exec { "Create stonith-fence_xvm-${safe_title}": + command => "/usr/sbin/pcs stonith create stonith-fence_xvm-${safe_title} fence_xvm pcmk_host_list=\"${pcmk_host_value_chunk}\" ${debug_chunk} ${ip_family_chunk} ${multicast_address_chunk} ${ipport_chunk} ${retrans_chunk} ${auth_chunk} ${hash_chunk} ${key_file_chunk} ${port_chunk} ${use_uuid_chunk} ${timeout_chunk} ${delay_chunk} ${domain_chunk} op monitor interval=${interval}", + unless => "/usr/sbin/pcs stonith show stonith-fence_xvm-${safe_title} > /dev/null 2>&1", + tries => $tries, + try_sleep => $try_sleep, + require => Class["pacemaker::corosync"], + } -> + exec { "Add non-local constraint for stonith-fence_xvm-${safe_title}": + command => "/usr/sbin/pcs constraint location stonith-fence_xvm-${safe_title} avoids ${pcmk_host_value_chunk}", + tries => $tries, + try_sleep => $try_sleep, } } }