Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ansible/roles/dashd/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ dashd_externalip: '{{ public_ip }}'
dashd_private_net_prefix: 16
dashd_private_cidr: '{{ private_ip | ansible.utils.ipsubnet(dashd_private_net_prefix) }}'

# When running devnet/regtest in local networks, we have to allow RFC1918/private addresses
dashd_allowprivatenet: '{% if dashd_externalip | ansible.utils.ipaddr("private") == dashd_externalip %}1{% else %}0{% endif %}'
# When running devnet/regtest in local networks, we have to allow RFC1918/private addresses.
# Avoid ansible.utils.ipaddr("private") here because some runner/library combinations
# return netaddr objects that do not expose the expected is_private attribute.
dashd_allowprivatenet: >-
{% if dashd_externalip is match('^(10\\.|127\\.|169\\.254\\.|192\\.168\\.|172\\.(1[6-9]|2[0-9]|3[0-1])\\.)') %}
1
{% else %}
0
{% endif %}

dashd_compose_project_name: dashcore
dashd_compose_path: '{{ dashd_home }}/{{ dashd_compose_project_name }}'
3 changes: 2 additions & 1 deletion ansible/roles/dashmate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@

- name: Set dashmate config version from already extracted version
ansible.builtin.set_fact:
dashmate_config_version: "{{ installed_dashmate_version }}"
dashmate_config_version: >-
{{ dashmate_version if installed_dashmate_version == 'none' else installed_dashmate_version }}
Comment on lines 258 to +261
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use the post-install version after upgrades.

installed_dashmate_version is captured before Install dashmate; on upgrades, this keeps dashmate_config_version pinned to the old version even after dashmate_needs_update installs dashmate_version.

🐛 Proposed fix
 - name: Set dashmate config version from already extracted version
   ansible.builtin.set_fact:
     dashmate_config_version: >-
-      {{ dashmate_version if installed_dashmate_version == 'none' else installed_dashmate_version }}
+      {{ dashmate_version if (installed_dashmate_version == 'none' or (dashmate_needs_update | default(false))) else installed_dashmate_version }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ansible/roles/dashmate/tasks/main.yml` around lines 258 - 261, The current
task "Set dashmate config version from already extracted version" sets
dashmate_config_version using installed_dashmate_version captured before
installation, which prevents using the newly installed version after an upgrade;
change the expression so that when dashmate_needs_update is true the task uses
dashmate_version (post-install) instead of the pre-captured
installed_dashmate_version. Update the set_fact for dashmate_config_version to
choose dashmate_version when installed_dashmate_version == 'none' OR
dashmate_needs_update is true, otherwise keep installed_dashmate_version.


# This check will return an error code if config is missing, config schema is invalid or default config is not yet set
- name: Check state of dashmate config
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/status_dashboard/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
status_dashboard_image: dashpay/status:latest
status_dashboard_port: 3010
status_dashboard_path: "{{ dashd_home }}/status_dashboard"
status_dashboard_ssh_private_key_path: "{{ lookup('env', 'STATUS_DASHBOARD_SSH_KEY_PATH') | default('~/.ssh/dashmon-testnet', true) }}"
status_dashboard_ssh_private_key_path: "{{ lookup('env', 'STATUS_DASHBOARD_SSH_KEY_PATH') | default(lookup('env', 'HOME') + '/.ssh/dashmon-testnet', true) }}"
status_dashboard_ssh_user: dashmon
status_dashboard_poll_interval: 10000
status_dashboard_poll_concurrency: 20
20 changes: 20 additions & 0 deletions ansible/roles/status_dashboard/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
---

- name: Check status dashboard SSH key on controller
ansible.builtin.stat:
path: "{{ status_dashboard_ssh_private_key_path }}"
register: status_dashboard_ssh_key_stat
delegate_to: localhost
become: false

- name: Skip status dashboard when controller SSH key is missing
ansible.builtin.debug:
msg: >-
Skipping status dashboard because SSH monitoring key was not found at
{{ status_dashboard_ssh_private_key_path }}.
Set STATUS_DASHBOARD_SSH_KEY_PATH on the controller to enable it.
when: not status_dashboard_ssh_key_stat.stat.exists

- name: Create status dashboard directory
ansible.builtin.file:
path: "{{ status_dashboard_path }}"
state: directory
recurse: true
when: status_dashboard_ssh_key_stat.stat.exists

- name: Copy inventory file for status dashboard
ansible.builtin.copy:
src: "{{ inventory_file }}"
dest: "{{ status_dashboard_path }}/inventory"
mode: "0644"
when: status_dashboard_ssh_key_stat.stat.exists

- name: Copy SSH monitoring key for status dashboard
ansible.builtin.copy:
Expand All @@ -20,16 +37,19 @@
owner: root
group: root
no_log: true
when: status_dashboard_ssh_key_stat.stat.exists

- name: Deploy status dashboard docker-compose
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ status_dashboard_path }}/docker-compose.yml"
mode: "0644"
when: status_dashboard_ssh_key_stat.stat.exists

- name: Start status dashboard
community.docker.docker_compose_v2:
project_src: "{{ status_dashboard_path }}"
state: present
pull: "{{ 'always' if (force_dashmate_reinstall | default(false) or not (skip_dashmate_image_update | default(false))) else 'policy' }}"
recreate: "{{ 'always' if (force_dashmate_rebuild | default(false)) else 'auto' }}"
when: status_dashboard_ssh_key_stat.stat.exists
Loading