Adding ansible example deploy server

This commit is contained in:
ditatompel 2024-05-06 20:51:44 +07:00
parent e7164ae0c1
commit 0804c4f055
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
3 changed files with 32 additions and 1 deletions

View file

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

View file

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

View file

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