|
1 | 1 | --- |
2 | 2 |
|
3 | | -- name: Ensure Appservice webhooks image is pulled |
4 | | - docker_image: |
5 | | - name: "{{ matrix_appservice_webhooks_docker_image }}" |
6 | | - source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" |
7 | | - force_source: "{{ matrix_appservice_webhooks_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" |
8 | | - force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_webhooks_docker_image_force_pull }}" |
9 | | - |
10 | 3 | - name: Ensure AppService webhooks paths exist |
11 | 4 | file: |
12 | | - path: "{{ item }}" |
| 5 | + path: "{{ item.path }}" |
13 | 6 | state: directory |
14 | 7 | mode: 0750 |
15 | 8 | owner: "{{ matrix_user_username }}" |
16 | 9 | group: "{{ matrix_user_groupname }}" |
17 | 10 | with_items: |
18 | | - - "{{ matrix_appservice_webhooks_base_path }}" |
19 | | - - "{{ matrix_appservice_webhooks_config_path }}" |
20 | | - - "{{ matrix_appservice_webhooks_data_path }}" |
| 11 | + - { path: "{{ matrix_appservice_webhooks_base_path }}", when: true } |
| 12 | + - { path: "{{ matrix_appservice_webhooks_config_path }}", when: true } |
| 13 | + - { path: "{{ matrix_appservice_webhooks_data_path }}", when: true } |
| 14 | + - { path: "{{ matrix_appservice_webhooks_docker_src_files_path }}", when: "{{ matrix_appservice_webhooks_container_image_self_build }}"} |
| 15 | + when: "item.when|bool" |
| 16 | + |
| 17 | +- name: Ensure Appservice webhooks image is pulled |
| 18 | + docker_image: |
| 19 | + name: "{{ matrix_appservice_webhooks_docker_image }}" |
| 20 | + source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" |
| 21 | + force_source: "{{ matrix_appservice_webhooks_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" |
| 22 | + force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_webhooks_docker_image_force_pull }}" |
| 23 | + when: "not matrix_appservice_webhooks_container_image_self_build|bool" |
| 24 | + |
| 25 | +- block: |
| 26 | + - name: Ensure Appservice webhooks repository is present on self-build |
| 27 | + git: |
| 28 | + repo: "{{ matrix_appservice_webhooks_container_image_self_build_repo }}" |
| 29 | + dest: "{{ matrix_appservice_webhooks_docker_src_files_path }}" |
| 30 | + version: "{{ matrix_appservice_webhooks_container_image_self_build_repo_version }}" |
| 31 | + force: "yes" |
| 32 | + register: matrix_appservice_webhooks_git_pull_results |
| 33 | + |
| 34 | + - name: Ensure Appservice webhooks Docker image is built |
| 35 | + docker_image: |
| 36 | + name: "{{ matrix_appservice_webhooks_docker_image }}" |
| 37 | + source: build |
| 38 | + force_source: "{{ matrix_appservice_webhooks_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" |
| 39 | + force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_webhooks_git_pull_results.changed }}" |
| 40 | + build: |
| 41 | + dockerfile: "{{ matrix_appservice_webhooks_container_image_self_build_repo_dockerfile_path }}" |
| 42 | + path: "{{ matrix_appservice_webhooks_docker_src_files_path }}" |
| 43 | + pull: yes |
| 44 | + when: "matrix_appservice_webhooks_container_image_self_build|bool" |
21 | 45 |
|
22 | 46 | - name: Ensure Matrix Appservice webhooks config is installed |
23 | 47 | copy: |
|
0 commit comments