diff --git a/defaults/main.yml b/defaults/main.yml index d3f42f2..bf376d5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,6 +5,7 @@ beacon_node_service_user_pass: '{{ ansible_date_time.epoch | password_hash("sha5 beacon_node_service_home: 'C:/Users/{{ beacon_node_service_user_name }}' beacon_node_service_path: '{{ beacon_node_service_home }}/{{ beacon_node_service_name }}' beacon_node_service_bin_path: '{{ beacon_node_service_path }}/bin' +beacon_node_service_exe: '{{ beacon_node_service_bin_path }}/nimbus_beacon_node.exe' beacon_node_repo_url: 'https://github.com/status-im/nimbus-eth2.git' beacon_node_repo_branch: 'stable' diff --git a/tasks/schedule.yml b/tasks/schedule.yml index a5bd996..cc6da20 100644 --- a/tasks/schedule.yml +++ b/tasks/schedule.yml @@ -11,21 +11,30 @@ triggers: - type: 'daily' start_boundary: '2021-01-01T01:00:00' - # Start it right away so we have the binary to run. - - type: registration state: 'present' enabled: true multiple_instances: 2 # Wait for running task + start_when_available: true disallow_start_if_on_batteries: false stop_if_going_on_batteries: false +- name: Check if binary exists + win_stat: + path: '{{ beacon_node_service_exe }}' + register: beacon_node_exe + +# Start it right away so we have the binary to run. +- name: Start the new scheduled task + win_shell: 'Start-ScheduledTask -TaskName {{ beacon_node_service_name }}-build' + when: not beacon_node_exe.stat.exists + - name: Wait for the node build to finish (SLOW) win_scheduled_task_stat: name: '{{ beacon_node_service_name }}-build' + when: not beacon_node_exe.stat.exists register: task_stat until: | - (task_stat.state is defined and - task_stat.state.status != "task_state_running" - ) or (task_stat.task_exists == false) - retries: 30 + task_stat.state is defined and + task_stat.state.status != "TASK_STATE_RUNNING" + retries: 50 delay: 30 diff --git a/tasks/service.yml b/tasks/service.yml index e62adb7..c9b80db 100644 --- a/tasks/service.yml +++ b/tasks/service.yml @@ -6,7 +6,7 @@ winsw_service_name: 'Nimbus Beacon Node' winsw_service_description: 'Nimbus Eth2 Beacon Node' winsw_service_user: 'nimbus' - winsw_service_exe_path: '{{ beacon_node_service_bin_path }}/nimbus_beacon_node.exe' + winsw_service_exe_path: '{{ beacon_node_service_exe }}' winsw_service_arguments: | --network={{ beacon_node_network }} --data-dir={{ beacon_node_data_path }}