Browse Source

feat: 增加:自动化运维一键运行脚本

Yin Bin 5 months ago
parent
commit
83ef2dcc5b

+ 3 - 0
script/ansible/README.md

@@ -0,0 +1,3 @@
+# 自动部署工具使用说明
+
+

+ 3 - 0
script/ansible/bin/build

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+mvn clean package -DskipTests=true -Pprod

+ 4 - 0
script/ansible/bin/build.bat

@@ -0,0 +1,4 @@
+@echo off
+setlocal
+
+mvn clean package -DskipTests=true -Pprod

+ 9 - 0
script/ansible/bin/deploy

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Set default APP_VERSION if not provided
+if [ -z "$APP_VERSION" ]; then
+    export APP_VERSION="latest"
+fi
+
+# Run the deploy playbook
+ansible-playbook ../deploy_playbook.yml -i ../inventory/hosts"$@"

+ 8 - 0
script/ansible/bin/deploy.bat

@@ -0,0 +1,8 @@
+@echo off
+setlocal
+
+:: Set default APP_VERSION if not provided
+if "%APP_VERSION%"=="" set APP_VERSION=latest
+
+:: Run the deploy playbook
+ansible-playbook ../deploy_playbook.yml -i ../inventory/hosts %*

+ 4 - 0
script/ansible/bin/frpc

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+# Run the frpc playbook
+ansible-playbook ../frpc_playbook.yml -i ../inventory/hosts "$@"

+ 4 - 0
script/ansible/bin/frpc.bat

@@ -0,0 +1,4 @@
+@echo off
+
+:: Run the frpc playbook
+ansible-playbook ../frpc_playbook.yml -i ../inventory/hosts %*

+ 8 - 0
script/ansible/bin/manage

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Default action is status if not specified
+ACTION=${1:-status}
+shift 2>/dev/null || true
+
+# Run the manage playbook with the specified action
+ansible-playbook ../manage_playbook.yml -i ../inventory/hosts -e "action=$ACTION" $@

+ 13 - 0
script/ansible/bin/manage.bat

@@ -0,0 +1,13 @@
+@echo off
+setlocal
+
+:: Default action is status if not specified
+if "%1"=="" (
+    set ACTION=status
+) else (
+    set ACTION=%1
+    shift
+)
+
+:: Run the manage playbook with the specified action
+ansible-playbook ../manage_playbook.yml -i ../inventory/hosts -e "action=%ACTION%" %*

+ 0 - 0
hosts → script/ansible/inventory/hosts