|
1 | 1 | --- |
2 | 2 |
|
| 3 | +- name: Check status dashboard SSH key on controller |
| 4 | + ansible.builtin.stat: |
| 5 | + path: "{{ status_dashboard_ssh_private_key_path }}" |
| 6 | + register: status_dashboard_ssh_key_stat |
| 7 | + delegate_to: localhost |
| 8 | + become: false |
| 9 | + |
| 10 | +- name: Skip status dashboard when controller SSH key is missing |
| 11 | + ansible.builtin.debug: |
| 12 | + msg: >- |
| 13 | + Skipping status dashboard because SSH monitoring key was not found at |
| 14 | + {{ status_dashboard_ssh_private_key_path }}. |
| 15 | + Set STATUS_DASHBOARD_SSH_KEY_PATH on the controller to enable it. |
| 16 | + when: not status_dashboard_ssh_key_stat.stat.exists |
| 17 | + |
3 | 18 | - name: Create status dashboard directory |
4 | 19 | ansible.builtin.file: |
5 | 20 | path: "{{ status_dashboard_path }}" |
6 | 21 | state: directory |
7 | 22 | recurse: true |
| 23 | + when: status_dashboard_ssh_key_stat.stat.exists |
8 | 24 |
|
9 | 25 | - name: Copy inventory file for status dashboard |
10 | 26 | ansible.builtin.copy: |
11 | 27 | src: "{{ inventory_file }}" |
12 | 28 | dest: "{{ status_dashboard_path }}/inventory" |
13 | 29 | mode: "0644" |
| 30 | + when: status_dashboard_ssh_key_stat.stat.exists |
14 | 31 |
|
15 | 32 | - name: Copy SSH monitoring key for status dashboard |
16 | 33 | ansible.builtin.copy: |
|
20 | 37 | owner: root |
21 | 38 | group: root |
22 | 39 | no_log: true |
| 40 | + when: status_dashboard_ssh_key_stat.stat.exists |
23 | 41 |
|
24 | 42 | - name: Deploy status dashboard docker-compose |
25 | 43 | ansible.builtin.template: |
26 | 44 | src: docker-compose.yml.j2 |
27 | 45 | dest: "{{ status_dashboard_path }}/docker-compose.yml" |
28 | 46 | mode: "0644" |
| 47 | + when: status_dashboard_ssh_key_stat.stat.exists |
29 | 48 |
|
30 | 49 | - name: Start status dashboard |
31 | 50 | community.docker.docker_compose_v2: |
32 | 51 | project_src: "{{ status_dashboard_path }}" |
33 | 52 | state: present |
34 | 53 | pull: "{{ 'always' if (force_dashmate_reinstall | default(false) or not (skip_dashmate_image_update | default(false))) else 'policy' }}" |
35 | 54 | recreate: "{{ 'always' if (force_dashmate_rebuild | default(false)) else 'auto' }}" |
| 55 | + when: status_dashboard_ssh_key_stat.stat.exists |
0 commit comments