|
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 | ) { |
18 | 25 | # pre-migration checks |
19 | 26 | out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported') |
|
25 | 32 |
|
26 | 33 | $new_hosts = peadm::flatten_compact([ |
27 | 34 | $new_primary_host, |
28 | | - $replica_host ? { undef => [], default => [$replica_host] } |
| 35 | + $replica_host ? { undef => [], default => [$replica_host] }, |
| 36 | + $primary_postgresql_host ? { undef => [], default => [$primary_postgresql_host] }, |
| 37 | + $replica_postgresql_host ? { undef => [], default => [$replica_postgresql_host] }, |
29 | 38 | ].flatten) |
30 | 39 | $all_hosts = peadm::flatten_compact([ |
31 | 40 | $old_primary_host, |
|
118 | 127 | out::message('No nodes to purge from old configuration') |
119 | 128 | } |
120 | 129 |
|
| 130 | + # provision a postgresql host if one is provided |
| 131 | + if $primary_postgresql_host { |
| 132 | + run_plan('peadm::add_database', targets => $primary_postgresql_host, |
| 133 | + primary_host => $new_primary_host, |
| 134 | + is_migration => true, |
| 135 | + ) |
| 136 | + # provision a replica postgresql host if one is provided |
| 137 | + if $replica_postgresql_host { |
| 138 | + run_plan('peadm::add_database', targets => $replica_postgresql_host, |
| 139 | + primary_host => $new_primary_host, |
| 140 | + is_migration => true, |
| 141 | + ) |
| 142 | + } |
| 143 | + } |
| 144 | + |
| 145 | + # provision a replica if one is provided |
121 | 146 | if $replica_host { |
122 | 147 | run_plan('peadm::add_replica', { |
123 | 148 | primary_host => $new_primary_host, |
124 | 149 | replica_host => $replica_host, |
| 150 | + replica_postgresql_host => $replica_postgresql_host, |
125 | 151 | }) |
126 | 152 | } |
127 | 153 |
|
|
134 | 160 | version => $upgrade_version, |
135 | 161 | download_mode => 'direct', |
136 | 162 | replica_host => $replica_host, |
| 163 | + primary_postgresql_host => $primary_postgresql_host, |
| 164 | + replica_postgresql_host => $replica_postgresql_host, |
137 | 165 | }) |
138 | 166 | } |
139 | 167 | } |
0 commit comments