diff --git a/Makefile b/Makefile index 1d3257e..59f9489 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ -.PHONY: ui build linux-amd64 linux-arm64 +.PHONY: 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: diff --git a/tools/ansible/deploy-server.example.yml b/tools/ansible/deploy-server.example.yml new file mode 100644 index 0000000..083374e --- /dev/null +++ b/tools/ansible/deploy-server.example.yml @@ -0,0 +1,21 @@ +--- +- name: Deploy and Restart Services + hosts: all + become: true + tasks: + - name: Stop server systemd daemon + systemd: + name: xmr-nodes-server.service + state: stopped + when: inventory_hostname in groups['server'] + + - name: Upload binary file + copy: + src: ../../bin/xmr-nodes-static-linux-amd64 + dest: /path/to/remote/server/bin + + - name: Start systemd daemon + systemd: + name: xmr-nodes-server.service + state: started + when: inventory_hostname in groups['server'] diff --git a/tools/ansible/inventory.example.ini b/tools/ansible/inventory.example.ini new file mode 100644 index 0000000..1e174a6 --- /dev/null +++ b/tools/ansible/inventory.example.ini @@ -0,0 +1,5 @@ +[server] +xmr-node-server ansible_host=192.168.0.2 ansible_user=xmr-nodes ansible_ssh_private_key_file=/path/to/ssh/private_key + +[prober] +prober-1 ansible_host=192.168.0.3 ansible_user=xmr-nodes