|
252 | 252 | register: constructa_dokku_plugins |
253 | 253 | changed_when: false |
254 | 254 |
|
| 255 | + - name: Check if Dokku redirect plugin installed |
| 256 | + become: true |
| 257 | + command: |
| 258 | + argv: |
| 259 | + - dokku |
| 260 | + - plugin:installed |
| 261 | + - redirect |
| 262 | + register: constructa_redirect_installed |
| 263 | + changed_when: false |
| 264 | + failed_when: constructa_redirect_installed.rc not in [0, 1] |
| 265 | + when: |
| 266 | + - constructa_redirect_enabled | default(false) | bool |
| 267 | + - constructa_redirect_plugin_repo is defined |
| 268 | + - constructa_redirect_plugin_repo | length > 0 |
| 269 | + |
255 | 270 | - name: Install Dokku redirect plugin when missing |
256 | 271 | become: true |
257 | 272 | command: |
258 | 273 | argv: |
259 | 274 | - dokku |
260 | 275 | - plugin:install |
261 | 276 | - "{{ constructa_redirect_plugin_repo | default('https://github.com/dokku/dokku-redirect.git') }}" |
| 277 | + - --committish |
| 278 | + - "{{ constructa_redirect_plugin_version }}" |
| 279 | + register: constructa_redirect_install |
| 280 | + when: |
| 281 | + - constructa_redirect_enabled | default(false) | bool |
| 282 | + - constructa_redirect_plugin_repo is defined |
| 283 | + - constructa_redirect_plugin_repo | length > 0 |
| 284 | + - constructa_redirect_plugin_version is defined |
| 285 | + - constructa_redirect_plugin_version | length > 0 |
| 286 | + - constructa_redirect_installed is defined |
| 287 | + - constructa_redirect_installed.rc != 0 |
| 288 | + changed_when: true |
| 289 | + |
| 290 | + - name: Pin Dokku redirect plugin to target version |
| 291 | + become: true |
| 292 | + command: |
| 293 | + argv: |
| 294 | + - dokku |
| 295 | + - plugin:update |
| 296 | + - redirect |
| 297 | + - "{{ constructa_redirect_plugin_version }}" |
| 298 | + register: constructa_redirect_update |
| 299 | + changed_when: >- |
| 300 | + constructa_redirect_update.stdout is defined and |
| 301 | + ('already' not in (constructa_redirect_update.stdout | lower)) |
262 | 302 | when: |
263 | 303 | - constructa_redirect_enabled | default(false) | bool |
264 | | - - constructa_dokku_plugins.stdout is defined |
265 | | - - not ('redirect' in (constructa_dokku_plugins.stdout | default(''))) |
| 304 | + - constructa_redirect_plugin_repo is defined |
| 305 | + - constructa_redirect_plugin_repo | length > 0 |
| 306 | + - constructa_redirect_plugin_version is defined |
| 307 | + - constructa_redirect_plugin_version | length > 0 |
| 308 | + - constructa_redirect_installed is defined |
| 309 | + - constructa_redirect_installed.rc == 0 |
| 310 | + |
| 311 | + - name: Check if Dokku letsencrypt plugin installed |
| 312 | + become: true |
| 313 | + command: |
| 314 | + argv: |
| 315 | + - dokku |
| 316 | + - plugin:installed |
| 317 | + - letsencrypt |
| 318 | + register: constructa_letsencrypt_installed |
| 319 | + changed_when: false |
| 320 | + failed_when: constructa_letsencrypt_installed.rc not in [0, 1] |
| 321 | + when: |
| 322 | + - constructa_letsencrypt_plugin_repo is defined |
| 323 | + - constructa_letsencrypt_plugin_repo | length > 0 |
266 | 324 |
|
267 | 325 | - name: Install Dokku letsencrypt plugin when missing |
268 | 326 | become: true |
|
271 | 329 | - dokku |
272 | 330 | - plugin:install |
273 | 331 | - "{{ constructa_letsencrypt_plugin_repo | default('https://github.com/dokku/dokku-letsencrypt.git') }}" |
| 332 | + - --committish |
| 333 | + - "{{ constructa_letsencrypt_plugin_version }}" |
| 334 | + register: constructa_letsencrypt_install |
| 335 | + when: |
| 336 | + - constructa_letsencrypt_plugin_repo is defined |
| 337 | + - constructa_letsencrypt_plugin_repo | length > 0 |
| 338 | + - constructa_letsencrypt_plugin_version is defined |
| 339 | + - constructa_letsencrypt_plugin_version | length > 0 |
| 340 | + - constructa_letsencrypt_installed is defined |
| 341 | + - constructa_letsencrypt_installed.rc != 0 |
| 342 | + changed_when: true |
| 343 | + |
| 344 | + - name: Pin Dokku letsencrypt plugin to target version |
| 345 | + become: true |
| 346 | + command: |
| 347 | + argv: |
| 348 | + - dokku |
| 349 | + - plugin:update |
| 350 | + - letsencrypt |
| 351 | + - "{{ constructa_letsencrypt_plugin_version }}" |
| 352 | + register: constructa_letsencrypt_update |
| 353 | + changed_when: >- |
| 354 | + constructa_letsencrypt_update.stdout is defined and |
| 355 | + ('already' not in (constructa_letsencrypt_update.stdout | lower)) |
274 | 356 | when: |
275 | 357 | - constructa_letsencrypt_plugin_repo is defined |
276 | 358 | - constructa_letsencrypt_plugin_repo | length > 0 |
277 | | - - constructa_dokku_plugins.stdout is defined |
278 | | - - not ('letsencrypt' in (constructa_dokku_plugins.stdout | default(''))) |
| 359 | + - constructa_letsencrypt_plugin_version is defined |
| 360 | + - constructa_letsencrypt_plugin_version | length > 0 |
| 361 | + - constructa_letsencrypt_installed is defined |
| 362 | + - constructa_letsencrypt_installed.rc == 0 |
279 | 363 |
|
280 | 364 | - name: Ensure secondary domains exist |
281 | 365 | become: true |
|
0 commit comments