|
7 | 7 | msg: |
8 | 8 | - "One or more required variables have empty values." |
9 | 9 | - "Please specify a value for the variables: pg_old_version, pg_new_version" |
10 | | - failed_when: pg_old_version | length < 1 or pg_new_version | length < 1 |
11 | | - when: pg_old_version | length < 1 or pg_new_version | length < 1 |
| 10 | + failed_when: pg_old_version | string | length < 1 or pg_new_version | string | length < 1 |
| 11 | + when: pg_old_version | string | length < 1 or pg_new_version | string | length < 1 |
12 | 12 |
|
13 | 13 | # Stop, if the directories of the old and new versions are the same |
14 | 14 | - name: "Make sure that the old and new data and config directories do not match" |
|
66 | 66 | changed_when: false |
67 | 67 | when: |
68 | 68 | - inventory_hostname in groups['primary'] |
69 | | - - pg_old_version is version('10', '>=') |
| 69 | + - pg_old_version | string is version('10', '>=') |
70 | 70 |
|
71 | 71 | # for compatibility with Postgres 9.x |
72 | 72 | - name: '[Pre-Check] Check the current version of PostgreSQL' |
|
77 | 77 | changed_when: false |
78 | 78 | when: |
79 | 79 | - inventory_hostname in groups['primary'] |
80 | | - - pg_old_version is version('10', '<') |
| 80 | + - pg_old_version | string is version('10', '<') |
81 | 81 |
|
82 | 82 | - name: "Set variable 'current_pg_version'" |
83 | 83 | ansible.builtin.set_fact: |
84 | | - current_pg_version: "{{ pg_current_version.stdout if pg_old_version is version('10', '>=') else pg_current_version_9x.stdout }}" |
| 84 | + current_pg_version: "{{ pg_current_version.stdout if pg_old_version | string is version('10', '>=') else pg_current_version_9x.stdout }}" |
85 | 85 | when: |
86 | 86 | - inventory_hostname in groups['primary'] |
87 | 87 |
|
|
168 | 168 | delay: 5 |
169 | 169 | when: |
170 | 170 | - inventory_hostname in groups['primary'] |
171 | | - - pg_old_version is version('10', '>=') |
| 171 | + - pg_old_version | string is version('10', '>=') |
172 | 172 |
|
173 | 173 | # Stop, if replication lag is high |
174 | 174 | - name: "Pre-Check error. High replication lag" |
|
195 | 195 | delay: 5 |
196 | 196 | when: |
197 | 197 | - inventory_hostname in groups['primary'] |
198 | | - - pg_old_version is version('10', '<') |
| 198 | + - pg_old_version | string is version('10', '<') |
199 | 199 |
|
200 | 200 | # Stop, if replication lag is high (for 9x) |
201 | 201 | - name: "Pre-Check error. High replication lag" |
|
223 | 223 | until: pg_long_transactions.stdout | length < 1 |
224 | 224 | retries: 30 # 1 minute |
225 | 225 | delay: 2 |
226 | | - when: pg_old_version is version('10', '>=') |
| 226 | + when: pg_old_version | string is version('10', '>=') |
227 | 227 |
|
228 | 228 | # Stop, if long-running transactions detected |
229 | 229 | - block: |
|
254 | 254 | until: pg_long_transactions_9x.stdout | length < 1 |
255 | 255 | retries: 30 # 1 minute |
256 | 256 | delay: 2 |
257 | | - when: pg_old_version is version('10', '<') |
| 257 | + when: pg_old_version | string is version('10', '<') |
258 | 258 |
|
259 | 259 | # Stop, if long-running transactions detected (for 9x) |
260 | 260 | - block: |
|
0 commit comments