|
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 | + if $primary_postgresql_host { |
| 131 | + run_plan('peadm::add_database', targets => $primary_postgresql_host, |
| 132 | + primary_host => $new_primary_host, |
| 133 | + is_migration => true, |
| 134 | + ) |
| 135 | + if $replica_postgresql_host { |
| 136 | + run_plan('peadm::add_database', targets => $replica_postgresql_host, |
| 137 | + primary_host => $new_primary_host, |
| 138 | + is_migration => true, |
| 139 | + ) |
| 140 | + } |
| 141 | + } |
| 142 | + |
121 | 143 | if $replica_host { |
122 | 144 | run_plan('peadm::add_replica', { |
123 | 145 | primary_host => $new_primary_host, |
124 | 146 | replica_host => $replica_host, |
| 147 | + replica_postgresql_host => $replica_postgresql_host, |
125 | 148 | }) |
126 | 149 | } |
127 | 150 |
|
|
134 | 157 | version => $upgrade_version, |
135 | 158 | download_mode => 'direct', |
136 | 159 | replica_host => $replica_host, |
| 160 | + primary_postgresql_host => $primary_postgresql_host, |
| 161 | + replica_postgresql_host => $replica_postgresql_host, |
137 | 162 | }) |
138 | 163 | } |
139 | 164 | } |
0 commit comments