|
8 | 8 | # The new server that will become the PE primary server |
9 | 9 | # @param upgrade_version |
10 | 10 | # Optional version to upgrade to after migration is complete |
11 | | -# |
| 11 | +# @param replica_host |
| 12 | +# Optional new replica server to be added to the cluster |
| 13 | +# @param primary_postgresql_host |
| 14 | +# Optional new primary PostgreSQL server to be added to the cluster |
| 15 | +# @param replica_postgresql_host |
| 16 | +# Optional new replica PostgreSQL server to be added to the cluster |
12 | 17 | plan peadm::migrate ( |
13 | 18 | Peadm::SingleTargetSpec $old_primary_host, |
14 | 19 | Peadm::SingleTargetSpec $new_primary_host, |
15 | 20 | Optional[String] $upgrade_version = undef, |
16 | 21 | Optional[Peadm::SingleTargetSpec] $replica_host = undef, |
| 22 | + Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef, |
| 23 | + Optional[Peadm::SingleTargetSpec] $replica_postgresql_host = undef, |
17 | 24 | ) { |
| 25 | + # Log parameters for debugging |
| 26 | + peadm::log_plan_parameters({ |
| 27 | + 'new_primary_host' => $new_primary_host, |
| 28 | + 'replica_host' => $replica_host, |
| 29 | + 'compiler_hosts' => $compiler_hosts, |
| 30 | + 'legacy_compilers' => $legacy_compilers, |
| 31 | + 'primary_postgresql_host' => $primary_postgresql_host, |
| 32 | + 'replica_postgresql_host' => $replica_postgresql_host, |
| 33 | + 'upgrade_version' => $upgrade_version, |
| 34 | + }) |
| 35 | + |
18 | 36 | # pre-migration checks |
19 | 37 | out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported') |
20 | 38 | peadm::assert_supported_bolt_version() |
|
25 | 43 |
|
26 | 44 | $new_hosts = peadm::flatten_compact([ |
27 | 45 | $new_primary_host, |
28 | | - $replica_host ? { undef => [], default => [$replica_host] } |
| 46 | + $replica_host ? { undef => [], default => [$replica_host] }, |
| 47 | + $primary_postgresql_host ? { undef => [], default => [$primary_postgresql_host] }, |
| 48 | + $replica_postgresql_host ? { undef => [], default => [$replica_postgresql_host] }, |
29 | 49 | ].flatten) |
30 | 50 | $all_hosts = peadm::flatten_compact([ |
31 | 51 | $old_primary_host, |
|
118 | 138 | out::message('No nodes to purge from old configuration') |
119 | 139 | } |
120 | 140 |
|
| 141 | + # provision a postgresql host if one is provided |
| 142 | + if $primary_postgresql_host { |
| 143 | + run_plan('peadm::add_database', targets => $primary_postgresql_host, |
| 144 | + primary_host => $new_primary_host, |
| 145 | + is_migration => true, |
| 146 | + ) |
| 147 | + # provision a replica postgresql host if one is provided |
| 148 | + if $replica_postgresql_host { |
| 149 | + run_plan('peadm::add_database', targets => $replica_postgresql_host, |
| 150 | + primary_host => $new_primary_host, |
| 151 | + is_migration => true, |
| 152 | + ) |
| 153 | + } |
| 154 | + } |
| 155 | + |
| 156 | + # provision a replica if one is provided |
121 | 157 | if $replica_host { |
122 | 158 | run_plan('peadm::add_replica', { |
123 | 159 | primary_host => $new_primary_host, |
124 | 160 | replica_host => $replica_host, |
| 161 | + replica_postgresql_host => $replica_postgresql_host, |
125 | 162 | }) |
126 | 163 | } |
127 | 164 |
|
|
134 | 171 | version => $upgrade_version, |
135 | 172 | download_mode => 'direct', |
136 | 173 | replica_host => $replica_host, |
| 174 | + primary_postgresql_host => $primary_postgresql_host, |
| 175 | + replica_postgresql_host => $replica_postgresql_host, |
137 | 176 | }) |
138 | 177 | } |
139 | 178 | } |
0 commit comments