diff --git a/Makefile b/Makefile index 59f9489..8f471b4 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,7 @@ -.PHONY: deploy-server ui build linux-amd64 linux-arm64 +.PHONY: deploy-prober deploy-server ui build linux-amd64 linux-arm64 BINARY_NAME = xmr-nodes -# Deploy server -# To use this, make sure the inventory and deploy-server.yml file is properly configured -deploy-server: build - ansible-playbook -i ./tools/ansible/inventory.ini -l server ./tools/ansible/deploy-server.yml -K - build: ui linux-amd64 linux-arm64 ui: @@ -22,3 +17,13 @@ clean: go clean rm -rfv ./bin rm -rf ./frontend/build + +# Deploying new binary file to server and probers host +# The deploy-* command doesn't build the binary file, so you need to run `make build` first. +# And make sure the inventory and deploy-*.yml file is properly configured. + +deploy-server: + ansible-playbook -i ./tools/ansible/inventory.ini -l server ./tools/ansible/deploy-server.yml -K + +deploy-prober: + ansible-playbook -i ./tools/ansible/inventory.ini -l prober ./tools/ansible/deploy-prober.yml -K diff --git a/tools/ansible/deploy-prober.example.yml b/tools/ansible/deploy-prober.example.yml new file mode 100644 index 0000000..a3a57df --- /dev/null +++ b/tools/ansible/deploy-prober.example.yml @@ -0,0 +1,35 @@ +--- +- name: Deploy and Restart Prober Timer + hosts: all + become: true + tasks: + - name: Stop prober systemd timer + systemd: + name: xmr-nodes-prober.timer + state: stopped + when: inventory_hostname in groups['prober'] + + - name: Upload binary file (AMD64) + copy: + src: ../../bin/xmr-nodes-static-linux-amd64 + dest: /path/to/remote/xmr-nodes/bin + owner: your_user + group: your_group + mode: 0755 + when: inventory_hostname in groups['prober'] + + - name: Upload binary file (ARM64) + copy: + src: ../../bin/xmr-nodes-static-linux-arm64 + dest: /path/to/remote/xmr-nodes/bin + owner: your_user + group: your_group + mode: 0755 + when: inventory_hostname in groups['prober'] + + + - name: Start systemd timer + systemd: + name: xmr-nodes-prober.timer + state: started + when: inventory_hostname in groups['prober']