Adding deploy-prober example

This commit is contained in:
ditatompel 2024-05-06 22:21:46 +07:00
parent 28f12b772b
commit e873d8f84a
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
2 changed files with 46 additions and 6 deletions

View file

@ -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

View file

@ -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']