From b8316e01d28094574ffec96673523584d0bf68a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 7 Jul 2022 10:25:42 +0200 Subject: [PATCH] tmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- .../nimbus-era-archive/defaults/main.yml | 8 +++++++ .../roles/nimbus-era-archive/tasks/main.yml | 22 +++++++++++++++++++ .../nimbus-era-archive/templates/update.sh.j2 | 11 ++++++++++ 3 files changed, 41 insertions(+) create mode 100644 ansible/roles/nimbus-era-archive/defaults/main.yml create mode 100644 ansible/roles/nimbus-era-archive/tasks/main.yml create mode 100644 ansible/roles/nimbus-era-archive/templates/update.sh.j2 diff --git a/ansible/roles/nimbus-era-archive/defaults/main.yml b/ansible/roles/nimbus-era-archive/defaults/main.yml new file mode 100644 index 0000000..7edad50 --- /dev/null +++ b/ansible/roles/nimbus-era-archive/defaults/main.yml @@ -0,0 +1,8 @@ +--- +nimbus_era_files_timer_name: 'nimbus-era-files-update' +nimbus_era_files_timer_path: '/data/era' +nimbus_era_files_timer_user: 'nimbus' +nimbus_era_files_timer_group: 'staff' +nimbus_era_files_timer_frequency: 'weekly' +nimbus_era_files_timer_timeout_sec: 82800 +nimbus_era_files_timer_script: '{{ nimbus_era_files_timer_path }}/update.sh' diff --git a/ansible/roles/nimbus-era-archive/tasks/main.yml b/ansible/roles/nimbus-era-archive/tasks/main.yml new file mode 100644 index 0000000..9a951a3 --- /dev/null +++ b/ansible/roles/nimbus-era-archive/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: Create ERA file update script + template: + src: 'update.sh.j2' + dest: '{{ nimbus_era_files_timer_script }}' + owner: '{{ nimbus_era_files_timer_user }}' + group: '{{ nimbus_era_files_timer_group }}' + mode: 0755 + +- name: Create timer for ERA file updates + include_role: name=systemd-timer + vars: + systemd_timer_description: 'Update Nimbus beacon node ERA files' + #systemd_timer_start_on_creation: false + systemd_timer_ionice_class: 'idle' + systemd_timer_name: '{{ nimbus_era_files_timer_name }}' + systemd_timer_user: '{{ nimbus_era_files_timer_user }}' + systemd_timer_group: '{{ nimbus_era_files_timer_group }}' + systemd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' + systemd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' + systemd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' + systemd_timer_script_path: '{{ nimbus_era_files_timer_script }}' diff --git a/ansible/roles/nimbus-era-archive/templates/update.sh.j2 b/ansible/roles/nimbus-era-archive/templates/update.sh.j2 new file mode 100644 index 0000000..8b4cfad --- /dev/null +++ b/ansible/roles/nimbus-era-archive/templates/update.sh.j2 @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# vim: ft=bash +set -eof pipefail + +BEACON_NODE_BIN_PATH="{{ TODO }}" +BEACON_NODE_DATA_DIR="{{ TODO }}" +BEACON_NODE_DB_DIR="${BEACON_NODE_DATA_DIR}/data/shared_mainnet_0/db" + +"${BEACON_NODE_BIN_PATH}/bin/ncli_db" exportEra --db="${BEACON_NODE_DB_DIR}" + +