Puppet Plan: ora_install::switch_home_asm

Defined in:
plans/switch_home_asm.pp

Summary

This plan will switch an Grid Infrastructure installation to an already existing other GRID_HOME.

Overview

See the file “LICENSE” for the full license governing this code.

--

–++–

Examples:

bolt plan run ora_install::switch_home_asm -t localhost new_home=/u01/app/grid/product/19.0.0.0/grid_home2

Parameters:

  • dbserver (TargetSpec)

    The target for this plan.

  • new_home (Stdlib::Absolutepath)

    The ORACLE_HOME where the database should be switched to.

  • format (Optional[Enum['json','pretty']]) (defaults to: 'pretty')

    Specify the format of the output, human readable (pretty) or not (json).

  • verbose (Optional[Optional[Enum['debug', 'info', 'notice', 'warning', 'err', 'alert', 'emerg', 'crit']]]) (defaults to: 'info')

    The level of verbosity to use.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'plans/switch_home_asm.pp', line 24

plan ora_install::switch_home_asm(
  #lint:ignore:strict_indent
  TargetSpec                      $dbserver,
  Stdlib::Absolutepath            $new_home,
  Optional[Enum['json','pretty']] $format  = 'pretty',
  Optional[Optional[Enum['debug', 'info', 'notice', 'warning', 'err', 'alert', 'emerg', 'crit']]]
                                  $verbose = 'info',
  #lint:endignore:strict_indent
) {
  if get_targets($dbserver).length > 1 {
    fail_plan("${dbserver} did not resolve to a single target")
  }
  $defaults = { format => $format, verbose => $verbose, '_catch_errors' => true }
  $tasks = [
    { 'ora_install::agent_action'       => { action => 'disable', comment => "Switching grid home to ${new_home}" } },
    { 'ora_install::grid_action'        => { action => 'stop' } },
    { 'ora_install::switch_grid_home'   => { new_home => $new_home } },
    { 'ora_install::grid_action'        => { action => 'start' } },
    { 'ora_install::agent_action'       => { action => 'enable' } },
  ]

  $tasks.each |$ind, $task| {
    $task.each |$key, $params| {
      $all_params = $params + $defaults
      $output = run_task($key, $dbserver, $all_params)
      $output.each |$result| {
        if $result.ok {
          if is_hash($result['message']) {
            $message = $result['message']['message']
          } else {
            $message = $result['message']
          }
          out::message("Task ${key} on ${dbserver} returned a value:\n${message}")
        } else {
          out::message("Task ${key} on ${dbserver} failed:\n${result['message']}")
          fail_plan("Task ${key} on ${dbserver} failed:\n${result['_error']['msg']}", $result['_error']['kind'], { 'failedtargets' => $dbserver })
        }
      }
    }
  }
}