From 183f0c8905b7c448d93433b8740673661023feab Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 18:27:33 +0000 Subject: [PATCH 1/9] feat: fix check mode for eth and core roles --- roles/geth/tasks/main.yaml | 2 ++ roles/vega_core/tasks/get-binaries.yaml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/roles/geth/tasks/main.yaml b/roles/geth/tasks/main.yaml index 4b1381a..f34b1da 100644 --- a/roles/geth/tasks/main.yaml +++ b/roles/geth/tasks/main.yaml @@ -17,6 +17,7 @@ remote_src: true dest: /tmp extra_opts: ['--strip-components=1', '--show-stored-names'] + when: not ansible_check_mode - name: Copy geth binary ansible.builtin.copy: @@ -26,3 +27,4 @@ owner: root group: root mode: '0755' + when: not ansible_check_mode diff --git a/roles/vega_core/tasks/get-binaries.yaml b/roles/vega_core/tasks/get-binaries.yaml index 9ff59c9..7219cb5 100644 --- a/roles/vega_core/tasks/get-binaries.yaml +++ b/roles/vega_core/tasks/get-binaries.yaml @@ -11,6 +11,7 @@ src: *vega_dest remote_src: true dest: /tmp + when: not ansible_check_mode - name: Copy vega binary ansible.builtin.copy: @@ -20,6 +21,7 @@ owner: root group: root mode: '0755' + when: not ansible_check_mode - name: Download visor binary ansible.builtin.get_url: @@ -33,6 +35,7 @@ src: *visor_dest remote_src: true dest: /tmp + when: not ansible_check_mode - name: Copy visor binary ansible.builtin.copy: @@ -42,3 +45,4 @@ owner: root group: root mode: '0755' + when: not ansible_check_mode From a65c1f2d11e19909d0beb2f4a1b8c8d6cae66654 Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 20:14:46 +0000 Subject: [PATCH 2/9] feat: add pyth price pusher role --- roles/pyth_price_scheduler/defaults/main.yaml | 10 +++ roles/pyth_price_scheduler/tasks/main.yaml | 6 ++ .../tasks/price-pusher.yaml | 69 +++++++++++++++++++ .../tasks/process-watcher.yaml | 46 +++++++++++++ .../system/pyth-price-scheduler.service.j2 | 31 +++++++++ .../system/pyth-process-watcher.service.j2 | 17 +++++ .../etc/pyth-process-watcher-config.toml | 23 +++++++ 7 files changed, 202 insertions(+) create mode 100644 roles/pyth_price_scheduler/defaults/main.yaml create mode 100644 roles/pyth_price_scheduler/tasks/main.yaml create mode 100644 roles/pyth_price_scheduler/tasks/price-pusher.yaml create mode 100644 roles/pyth_price_scheduler/tasks/process-watcher.yaml create mode 100644 roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 create mode 100644 roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 create mode 100644 roles/pyth_price_scheduler/templates/etc/pyth-process-watcher-config.toml diff --git a/roles/pyth_price_scheduler/defaults/main.yaml b/roles/pyth_price_scheduler/defaults/main.yaml new file mode 100644 index 0000000..100bcba --- /dev/null +++ b/roles/pyth_price_scheduler/defaults/main.yaml @@ -0,0 +1,10 @@ +pyth_price_scheduler_name: primary +pyth_price_scheduler_docker_image: public.ecr.aws/pyth-network/xc-price-pusher:v8.0.0 +pyth_price_scheduler_mnemonic: "PUT_MNEMONIC_HERE" +pyth_price_scheduler_endpoint: "PUT_HERE_RPC_URL" +pyth_price_scheduler_contract_address: "PUT_HERE_CONTRACT_ADDRESS" +pyth_price_scheduler_service_endpoint: https://hermes.pyth.network +pyth_price_scheduler_price_config_content: "PUT_CONFIG_HERE" + +pyth_price_scheduler_process_watcher_version: "v0.1.0" +pyth_price_scheduler_process_watcher_repository: "vegaprotocol/process-watcher" \ No newline at end of file diff --git a/roles/pyth_price_scheduler/tasks/main.yaml b/roles/pyth_price_scheduler/tasks/main.yaml new file mode 100644 index 0000000..420c0ba --- /dev/null +++ b/roles/pyth_price_scheduler/tasks/main.yaml @@ -0,0 +1,6 @@ + +- name: Process watcher + ansible.builtin.import_tasks: process-watcher.yaml + +- name: Price pusher + ansible.builtin.import_tasks: price-pusher.yaml \ No newline at end of file diff --git a/roles/pyth_price_scheduler/tasks/price-pusher.yaml b/roles/pyth_price_scheduler/tasks/price-pusher.yaml new file mode 100644 index 0000000..a86590f --- /dev/null +++ b/roles/pyth_price_scheduler/tasks/price-pusher.yaml @@ -0,0 +1,69 @@ +--- +- name: Install python packages for Ansible + ansible.builtin.pip: + name: + - docker + +- name: Pull an price scheduler docker image + community.docker.docker_image: + name: "{{- pyth_price_scheduler_docker_image -}}" + source: pull + pull: + platform: amd64 + +- name: Ensure group "pyth-price-scheduler" exists + ansible.builtin.group: + name: pyth-price-scheduler + state: present + +- name: Add the user "pyth-price-scheduler" + ansible.builtin.user: + name: pyth-price-scheduler + comment: Price scheduler + groups: pyth-price-scheduler,docker + +- name: Copy service file + ansible.builtin.template: + src: "lib/systemd/system/pyth-price-scheduler.service.j2" + dest: "/lib/systemd/system/pyth-price-scheduler.service" + owner: root + group: root + mode: '0644' + +- name: "Create config directory for the pyth-price-scheduler" + ansible.builtin.file: + path: "/home/pyth-price-scheduler" + state: directory + owner: pyth-price-scheduler + group: pyth-price-scheduler + mode: '0755' + +- name: Copy config file + ansible.builtin.copy: + dest: "home/pyth-price-scheduler/price-config.yaml" + content: "{{ pyth_price_scheduler_price_config_content }}" + owner: pyth-price-scheduler + group: pyth-price-scheduler + mode: '0644' + +- name: Save mnemonic + ansible.builtin.copy: + owner: pyth-price-scheduler + group: pyth-price-scheduler + content: "{{- pyth_price_scheduler_mnemonic -}}" + dest: /home/pyth-price-scheduler/mnemonic + +# - name: Stop watcher if service if exists +# ansible.builtin.service: +# name: "pyth-process-watcher" +# state: stopped +# enabled: true +# daemon_reload: true +# ignore_errors: true # may be missing at this point + +- name: Start and enable systemd service for pyth-price-scheduler + ansible.builtin.service: + name: "pyth-price-scheduler" + state: restarted + enabled: true + daemon_reload: true \ No newline at end of file diff --git a/roles/pyth_price_scheduler/tasks/process-watcher.yaml b/roles/pyth_price_scheduler/tasks/process-watcher.yaml new file mode 100644 index 0000000..ab8bd9d --- /dev/null +++ b/roles/pyth_price_scheduler/tasks/process-watcher.yaml @@ -0,0 +1,46 @@ +--- +- name: Download binary + ansible.builtin.get_url: + url: "https://github.com/{{- pyth_price_scheduler_process_watcher_repository -}}/releases/download/v0.0.1/process-watcher-linux-amd64.zip" + dest: &watcherdist /tmp/process-watcher.tar.gz + mode: '0600' + +- name: Unpack binary + ansible.builtin.unarchive: + src: *watcherdist + remote_src: true + dest: /tmp + +- name: Copy the binary + ansible.builtin.copy: + remote_src: true + src: "/tmp/process-watcher" + dest: /usr/bin/process-watcher + owner: root + group: root + mode: '0755' + + +- name: Copy process watcher config + ansible.builtin.template: + src: "etc/pyth-process-watcher-config.toml" + dest: "/etc/pyth-process-watcher-config-{{- price_pusher_name -}}.toml" + owner: root + group: root + mode: '0644' + +- name: Copy process watcher service file + ansible.builtin.template: + src: "lib/systemd/system/pyth-process-watcher.service.j2" + dest: "/lib/systemd/system/pyth-process-watcher-{{- price_pusher_name -}}.service" + owner: root + group: root + mode: '0644' + + +- name: Start pusher watcher service + ansible.builtin.service: + name: "pyth-process-watcher-{{- price_pusher_name -}}" + state: restarted + enabled: true + daemon_reload: true \ No newline at end of file diff --git a/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 b/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 new file mode 100644 index 0000000..02cfc03 --- /dev/null +++ b/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 @@ -0,0 +1,31 @@ +[Unit] +Description=Pyth price pusher {{ price_pusher_name }} +Documentation=https://github.com/pyth-network/pyth-crosschain/tree/main/price_pusher +After=docker.service +Requires=docker.service + +[Service] +User=pyth-price-scheduler +Group=pyth-price-scheduler +TimeoutStartSec=0 +Restart=always +ExecStop=/usr/bin/docker kill pyth-price-scheduler +ExecStartPre=-/usr/bin/docker stop pyth-price-scheduler +ExecStartPre=-/usr/bin/docker rm pyth-price-scheduler +ExecStartPre=/usr/bin/docker pull {{ pyth_price_scheduler_docker_image }} +ExecStart=/usr/bin/docker run \ + --name pyth-price-scheduler \ + -v /home/pyth-price-scheduler:/config \ + {{ pyth_price_scheduler_docker_image }} \ + -- \ + evm \ + --endpoint "{{- price_pusher_endpoint -}}" \ + --mnemonic-file "/config/mnemonic" \ + --pyth-contract-address "{{- pyth_price_scheduler_contract_address -}}" \ + --price-service-endpoint "{{- pyth_price_scheduler_service_endpoint -}}" \ + --price-config-file "/config/price-config.yaml" \ + --polling-frequency 5 + + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 b/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 new file mode 100644 index 0000000..e56733f --- /dev/null +++ b/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 @@ -0,0 +1,17 @@ +[Unit] +Description=Pyth price process watcher {{ price_pusher_name }} +Documentation=https://github.com/vegaprotocol/process-watcher +After=docker.service +Requires=docker.service +After=network.target network-online.target +Requires=network-online.target + +[Service] +User=root +Group=root +TimeoutStartSec=0 +Restart=always +ExecStart=/usr/bin/process-watcher run --config-path /etc/pyth-process-watcher-config-{{- price_pusher_name -}}.toml + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/roles/pyth_price_scheduler/templates/etc/pyth-process-watcher-config.toml b/roles/pyth_price_scheduler/templates/etc/pyth-process-watcher-config.toml new file mode 100644 index 0000000..ab84735 --- /dev/null +++ b/roles/pyth_price_scheduler/templates/etc/pyth-process-watcher-config.toml @@ -0,0 +1,23 @@ +[commands] + # Define the log stream command + log-stream = [ + "/usr/bin/journalctl", + "-u", "pyth-price-scheduler", + "-n", "1", + "-f", + ] + # Define the command used to stop the service + stop = ["/usr/bin/systemctl", "stop", "pyth-price-scheduler"] + # Define the command to start the service + start = ["/usr/bin/systemctl", "start", "pyth-price-scheduler"] + + +[process-watcher] + # Watches if specific docker container is running + [process-watcher.docker] + enabled = true + container-name = "pyth-price-scheduler" + +[logs-watcher] + # Define the keywords that trigger process restart + failure-keywords = ["err", "failed", "throw err", "error"] \ No newline at end of file From 787cdf5da5d36c573f8f7382643767348c940fce Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 21:59:57 +0000 Subject: [PATCH 3/9] feat: refactor role for pyth-price-scheduler --- roles/pyth_price_scheduler/defaults/main.yaml | 3 +-- roles/pyth_price_scheduler/tasks/price-pusher.yaml | 2 +- roles/pyth_price_scheduler/tasks/process-watcher.yaml | 6 +++--- .../lib/systemd/system/pyth-price-scheduler.service.j2 | 6 +++--- .../lib/systemd/system/pyth-process-watcher.service.j2 | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) rename roles/pyth_price_scheduler/templates/{etc => }/lib/systemd/system/pyth-price-scheduler.service.j2 (89%) rename roles/pyth_price_scheduler/templates/{etc => }/lib/systemd/system/pyth-process-watcher.service.j2 (75%) diff --git a/roles/pyth_price_scheduler/defaults/main.yaml b/roles/pyth_price_scheduler/defaults/main.yaml index 100bcba..236dceb 100644 --- a/roles/pyth_price_scheduler/defaults/main.yaml +++ b/roles/pyth_price_scheduler/defaults/main.yaml @@ -1,6 +1,5 @@ -pyth_price_scheduler_name: primary pyth_price_scheduler_docker_image: public.ecr.aws/pyth-network/xc-price-pusher:v8.0.0 -pyth_price_scheduler_mnemonic: "PUT_MNEMONIC_HERE" +pyth_price_scheduler_mnemonic: "PUT_PRIVATE_KEY_HERE" pyth_price_scheduler_endpoint: "PUT_HERE_RPC_URL" pyth_price_scheduler_contract_address: "PUT_HERE_CONTRACT_ADDRESS" pyth_price_scheduler_service_endpoint: https://hermes.pyth.network diff --git a/roles/pyth_price_scheduler/tasks/price-pusher.yaml b/roles/pyth_price_scheduler/tasks/price-pusher.yaml index a86590f..7fee908 100644 --- a/roles/pyth_price_scheduler/tasks/price-pusher.yaml +++ b/roles/pyth_price_scheduler/tasks/price-pusher.yaml @@ -40,7 +40,7 @@ - name: Copy config file ansible.builtin.copy: - dest: "home/pyth-price-scheduler/price-config.yaml" + dest: "/home/pyth-price-scheduler/price-config.yaml" content: "{{ pyth_price_scheduler_price_config_content }}" owner: pyth-price-scheduler group: pyth-price-scheduler diff --git a/roles/pyth_price_scheduler/tasks/process-watcher.yaml b/roles/pyth_price_scheduler/tasks/process-watcher.yaml index ab8bd9d..cd25cf7 100644 --- a/roles/pyth_price_scheduler/tasks/process-watcher.yaml +++ b/roles/pyth_price_scheduler/tasks/process-watcher.yaml @@ -24,7 +24,7 @@ - name: Copy process watcher config ansible.builtin.template: src: "etc/pyth-process-watcher-config.toml" - dest: "/etc/pyth-process-watcher-config-{{- price_pusher_name -}}.toml" + dest: "/etc/pyth-process-watcher-config.toml" owner: root group: root mode: '0644' @@ -32,7 +32,7 @@ - name: Copy process watcher service file ansible.builtin.template: src: "lib/systemd/system/pyth-process-watcher.service.j2" - dest: "/lib/systemd/system/pyth-process-watcher-{{- price_pusher_name -}}.service" + dest: "/lib/systemd/system/pyth-process-watcher.service" owner: root group: root mode: '0644' @@ -40,7 +40,7 @@ - name: Start pusher watcher service ansible.builtin.service: - name: "pyth-process-watcher-{{- price_pusher_name -}}" + name: "pyth-process-watcher" state: restarted enabled: true daemon_reload: true \ No newline at end of file diff --git a/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 b/roles/pyth_price_scheduler/templates/lib/systemd/system/pyth-price-scheduler.service.j2 similarity index 89% rename from roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 rename to roles/pyth_price_scheduler/templates/lib/systemd/system/pyth-price-scheduler.service.j2 index 02cfc03..f947ae5 100644 --- a/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-price-scheduler.service.j2 +++ b/roles/pyth_price_scheduler/templates/lib/systemd/system/pyth-price-scheduler.service.j2 @@ -1,5 +1,5 @@ [Unit] -Description=Pyth price pusher {{ price_pusher_name }} +Description=Pyth price pusher Documentation=https://github.com/pyth-network/pyth-crosschain/tree/main/price_pusher After=docker.service Requires=docker.service @@ -17,9 +17,9 @@ ExecStart=/usr/bin/docker run \ --name pyth-price-scheduler \ -v /home/pyth-price-scheduler:/config \ {{ pyth_price_scheduler_docker_image }} \ - -- \ + npm run start -- \ evm \ - --endpoint "{{- price_pusher_endpoint -}}" \ + --endpoint "{{- pyth_price_scheduler_endpoint -}}" \ --mnemonic-file "/config/mnemonic" \ --pyth-contract-address "{{- pyth_price_scheduler_contract_address -}}" \ --price-service-endpoint "{{- pyth_price_scheduler_service_endpoint -}}" \ diff --git a/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 b/roles/pyth_price_scheduler/templates/lib/systemd/system/pyth-process-watcher.service.j2 similarity index 75% rename from roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 rename to roles/pyth_price_scheduler/templates/lib/systemd/system/pyth-process-watcher.service.j2 index e56733f..33004f3 100644 --- a/roles/pyth_price_scheduler/templates/etc/lib/systemd/system/pyth-process-watcher.service.j2 +++ b/roles/pyth_price_scheduler/templates/lib/systemd/system/pyth-process-watcher.service.j2 @@ -1,5 +1,5 @@ [Unit] -Description=Pyth price process watcher {{ price_pusher_name }} +Description=Pyth price process watcher Documentation=https://github.com/vegaprotocol/process-watcher After=docker.service Requires=docker.service @@ -11,7 +11,7 @@ User=root Group=root TimeoutStartSec=0 Restart=always -ExecStart=/usr/bin/process-watcher run --config-path /etc/pyth-process-watcher-config-{{- price_pusher_name -}}.toml +ExecStart=/usr/bin/process-watcher run --config-path /etc/pyth-process-watcher-config.toml [Install] WantedBy=multi-user.target \ No newline at end of file From 72f7f01042a15b7c097eb9720e8c2e94930eff73 Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 22:00:08 +0000 Subject: [PATCH 4/9] feat: add role for docker --- roles/docker/tasks/main.yaml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 roles/docker/tasks/main.yaml diff --git a/roles/docker/tasks/main.yaml b/roles/docker/tasks/main.yaml new file mode 100644 index 0000000..7d2a9ea --- /dev/null +++ b/roles/docker/tasks/main.yaml @@ -0,0 +1,40 @@ +--- +- name: Install software + ansible.builtin.apt: + update_cache: true + name: + - apt-transport-https + - ca-certificates + - curl + - software-properties-common + +- name: Add apt key for required repositories + ansible.builtin.apt_key: + url: '{{ item }}' + state: present + with_items: + # docker + - https://download.docker.com/linux/ubuntu/gpg + +- name: Add required source repositories into sources list + ansible.builtin.apt_repository: + repo: '{{ item }}' + state: present + with_items: + - "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" + +- name: Install software + ansible.builtin.apt: + update_cache: true + name: + - docker-ce + - docker-ce-cli + - containerd.io + - docker-buildx-plugin + - docker-compose-plugin + +- name: Restart docker + ansible.builtin.systemd: + state: restarted + daemon_reload: true + name: docker \ No newline at end of file From 3edfcdd86feaa31b4e5c53c416054f9eccadc98e Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 22:00:30 +0000 Subject: [PATCH 5/9] feat: add common packages into vega_common roles --- roles/vega_common/tasks/main.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/vega_common/tasks/main.yaml b/roles/vega_common/tasks/main.yaml index 6aa1eee..15c05c9 100644 --- a/roles/vega_common/tasks/main.yaml +++ b/roles/vega_common/tasks/main.yaml @@ -11,6 +11,14 @@ - acl - unzip - gzip + - tar + - bzip2 + +- name: Install Python and pip + ansible.builtin.apt: + pkg: + - python3 + - python3-pip - name: Ensure group "vega" exists ansible.builtin.group: From 411733f523444e1b6731332e24e837e49db1a664 Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 22:14:33 +0000 Subject: [PATCH 6/9] feat: peer review changes --- roles/pyth_price_scheduler/tasks/price-pusher.yaml | 8 -------- roles/pyth_price_scheduler/tasks/process-watcher.yaml | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/roles/pyth_price_scheduler/tasks/price-pusher.yaml b/roles/pyth_price_scheduler/tasks/price-pusher.yaml index 7fee908..bb59b68 100644 --- a/roles/pyth_price_scheduler/tasks/price-pusher.yaml +++ b/roles/pyth_price_scheduler/tasks/price-pusher.yaml @@ -53,14 +53,6 @@ content: "{{- pyth_price_scheduler_mnemonic -}}" dest: /home/pyth-price-scheduler/mnemonic -# - name: Stop watcher if service if exists -# ansible.builtin.service: -# name: "pyth-process-watcher" -# state: stopped -# enabled: true -# daemon_reload: true -# ignore_errors: true # may be missing at this point - - name: Start and enable systemd service for pyth-price-scheduler ansible.builtin.service: name: "pyth-price-scheduler" diff --git a/roles/pyth_price_scheduler/tasks/process-watcher.yaml b/roles/pyth_price_scheduler/tasks/process-watcher.yaml index cd25cf7..91c3c3f 100644 --- a/roles/pyth_price_scheduler/tasks/process-watcher.yaml +++ b/roles/pyth_price_scheduler/tasks/process-watcher.yaml @@ -1,7 +1,7 @@ --- - name: Download binary ansible.builtin.get_url: - url: "https://github.com/{{- pyth_price_scheduler_process_watcher_repository -}}/releases/download/v0.0.1/process-watcher-linux-amd64.zip" + url: "https://github.com/{{- pyth_price_scheduler_process_watcher_repository -}}/releases/download/{{- pyth_price_scheduler_process_watcher_version -}}/process-watcher-linux-amd64.zip" dest: &watcherdist /tmp/process-watcher.tar.gz mode: '0600' From 47800faf0b544054be41e0bf8a1dd267b99521f5 Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 22:19:43 +0000 Subject: [PATCH 7/9] fix: linting issues --- roles/docker/tasks/main.yaml | 2 +- roles/pyth_price_scheduler/defaults/main.yaml | 3 ++- roles/pyth_price_scheduler/tasks/main.yaml | 4 ++-- roles/pyth_price_scheduler/tasks/price-pusher.yaml | 5 +++-- roles/pyth_price_scheduler/tasks/process-watcher.yaml | 8 +++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/docker/tasks/main.yaml b/roles/docker/tasks/main.yaml index 7d2a9ea..2050bec 100644 --- a/roles/docker/tasks/main.yaml +++ b/roles/docker/tasks/main.yaml @@ -37,4 +37,4 @@ ansible.builtin.systemd: state: restarted daemon_reload: true - name: docker \ No newline at end of file + name: docker diff --git a/roles/pyth_price_scheduler/defaults/main.yaml b/roles/pyth_price_scheduler/defaults/main.yaml index 236dceb..6424de2 100644 --- a/roles/pyth_price_scheduler/defaults/main.yaml +++ b/roles/pyth_price_scheduler/defaults/main.yaml @@ -1,3 +1,4 @@ +--- pyth_price_scheduler_docker_image: public.ecr.aws/pyth-network/xc-price-pusher:v8.0.0 pyth_price_scheduler_mnemonic: "PUT_PRIVATE_KEY_HERE" pyth_price_scheduler_endpoint: "PUT_HERE_RPC_URL" @@ -6,4 +7,4 @@ pyth_price_scheduler_service_endpoint: https://hermes.pyth.network pyth_price_scheduler_price_config_content: "PUT_CONFIG_HERE" pyth_price_scheduler_process_watcher_version: "v0.1.0" -pyth_price_scheduler_process_watcher_repository: "vegaprotocol/process-watcher" \ No newline at end of file +pyth_price_scheduler_process_watcher_repository: "vegaprotocol/process-watcher" diff --git a/roles/pyth_price_scheduler/tasks/main.yaml b/roles/pyth_price_scheduler/tasks/main.yaml index 420c0ba..50bbead 100644 --- a/roles/pyth_price_scheduler/tasks/main.yaml +++ b/roles/pyth_price_scheduler/tasks/main.yaml @@ -1,6 +1,6 @@ - +--- - name: Process watcher ansible.builtin.import_tasks: process-watcher.yaml - name: Price pusher - ansible.builtin.import_tasks: price-pusher.yaml \ No newline at end of file + ansible.builtin.import_tasks: price-pusher.yaml diff --git a/roles/pyth_price_scheduler/tasks/price-pusher.yaml b/roles/pyth_price_scheduler/tasks/price-pusher.yaml index bb59b68..0107340 100644 --- a/roles/pyth_price_scheduler/tasks/price-pusher.yaml +++ b/roles/pyth_price_scheduler/tasks/price-pusher.yaml @@ -44,7 +44,7 @@ content: "{{ pyth_price_scheduler_price_config_content }}" owner: pyth-price-scheduler group: pyth-price-scheduler - mode: '0644' + mode: "0644" - name: Save mnemonic ansible.builtin.copy: @@ -52,10 +52,11 @@ group: pyth-price-scheduler content: "{{- pyth_price_scheduler_mnemonic -}}" dest: /home/pyth-price-scheduler/mnemonic + mode: "0644" - name: Start and enable systemd service for pyth-price-scheduler ansible.builtin.service: name: "pyth-price-scheduler" state: restarted enabled: true - daemon_reload: true \ No newline at end of file + daemon_reload: true diff --git a/roles/pyth_price_scheduler/tasks/process-watcher.yaml b/roles/pyth_price_scheduler/tasks/process-watcher.yaml index 91c3c3f..c55d6d0 100644 --- a/roles/pyth_price_scheduler/tasks/process-watcher.yaml +++ b/roles/pyth_price_scheduler/tasks/process-watcher.yaml @@ -1,7 +1,7 @@ --- - name: Download binary ansible.builtin.get_url: - url: "https://github.com/{{- pyth_price_scheduler_process_watcher_repository -}}/releases/download/{{- pyth_price_scheduler_process_watcher_version -}}/process-watcher-linux-amd64.zip" + url: "https://github.com/{{- pyth_price_scheduler_process_watcher_repository -}}/releases/download/{{- pyth_price_scheduler_process_watcher_version -}}/process-watcher-linux-amd64.zip" # noqa: yaml[line-length] dest: &watcherdist /tmp/process-watcher.tar.gz mode: '0600' @@ -19,8 +19,7 @@ owner: root group: root mode: '0755' - - + - name: Copy process watcher config ansible.builtin.template: src: "etc/pyth-process-watcher-config.toml" @@ -37,10 +36,9 @@ group: root mode: '0644' - - name: Start pusher watcher service ansible.builtin.service: name: "pyth-process-watcher" state: restarted enabled: true - daemon_reload: true \ No newline at end of file + daemon_reload: true From 9d27ee6f3a4c1bb824b1f14091c32c92c1b5f663 Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 22:22:13 +0000 Subject: [PATCH 8/9] fix: ansible linting --- .ansible-lint | 1 + 1 file changed, 1 insertion(+) diff --git a/.ansible-lint b/.ansible-lint index 4bb121a..45c4c5d 100755 --- a/.ansible-lint +++ b/.ansible-lint @@ -4,3 +4,4 @@ mock_modules: - community.postgresql.postgresql_db - community.postgresql.postgresql_user - community.postgresql.postgresql_owner + - community.docker.docker_image From d3d01c49838a75593b76dcc7fc7b1cd441af171a Mon Sep 17 00:00:00 2001 From: 0xdeadcode Date: Wed, 9 Oct 2024 22:37:27 +0000 Subject: [PATCH 9/9] fix: ansible linting in the existing roles --- roles/grafana_agent/defaults/main.yaml | 3 ++- roles/grafana_agent/handlers/main.yaml | 3 ++- roles/grafana_agent/tasks/main.yaml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/roles/grafana_agent/defaults/main.yaml b/roles/grafana_agent/defaults/main.yaml index e38cee6..d5f3c19 100644 --- a/roles/grafana_agent/defaults/main.yaml +++ b/roles/grafana_agent/defaults/main.yaml @@ -1,5 +1,6 @@ --- grafana_agent_version: 0.43.0 grafana_agent_repository: grafana/agent -# config template may be loaded when the lookup plugin is enabled with the following snipped "{{ lookup('file', 'configs/grafana-agent-monitoring-template.yaml') }}" +# config template may be loaded when the lookup plugin is enabled with the following snipped: +# "{{ lookup('file', 'configs/grafana-agent-monitoring-template.yaml') }}" grafana_agent_config_content: "# empty content" diff --git a/roles/grafana_agent/handlers/main.yaml b/roles/grafana_agent/handlers/main.yaml index 10c0494..7fc95e6 100644 --- a/roles/grafana_agent/handlers/main.yaml +++ b/roles/grafana_agent/handlers/main.yaml @@ -1,6 +1,7 @@ +--- - name: Restart grafana-agent ansible.builtin.service: name: grafana-agent state: restarted listen: Restart grafana-agent - when: not ansible_check_mode \ No newline at end of file + when: not ansible_check_mode diff --git a/roles/grafana_agent/tasks/main.yaml b/roles/grafana_agent/tasks/main.yaml index 531b0c6..3200103 100644 --- a/roles/grafana_agent/tasks/main.yaml +++ b/roles/grafana_agent/tasks/main.yaml @@ -1,7 +1,7 @@ --- - name: Grafana Agent | Install grafana-agent ansible.builtin.apt: - deb: "https://github.com/{{- grafana_agent_repository -}}/releases/download/v{{- grafana_agent_version -}}/grafana-agent-{{- grafana_agent_version -}}-1.amd64.deb" + deb: "https://github.com/{{- grafana_agent_repository -}}/releases/download/v{{- grafana_agent_version -}}/grafana-agent-{{- grafana_agent_version -}}-1.amd64.deb" # noqa: yaml[line-length] - name: Grafana Agent | Update CUSTOM_ARGS environment variables for grafana config ansible.builtin.lineinfile: