fix: 将 k3s-ansible 作为普通目录添加

This commit is contained in:
fei
2026-02-04 23:43:40 +08:00
commit 7f6c8b9b92
40 changed files with 10909 additions and 0 deletions

93
init-git-repo.sh Executable file
View File

@@ -0,0 +1,93 @@
#!/bin/bash
# Git仓库初始化脚本
echo "🚀 初始化K3s部署配置Git仓库"
echo "================================"
echo ""
# 检查是否已经是Git仓库
if [ -d .git ]; then
echo "⚠️ 当前目录已经是Git仓库"
echo "是否要重新初始化?(y/N)"
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo "❌ 取消操作"
exit 0
fi
rm -rf .git
fi
# 初始化Git仓库
echo "📦 初始化Git仓库..."
git init -b main
# 配置Git用户信息
echo ""
echo "请输入Git用户信息"
read -p "用户名 (默认: K3s Admin): " git_user
read -p "邮箱 (默认: admin@example.com): " git_email
git_user=${git_user:-"K3s Admin"}
git_email=${git_email:-"admin@example.com"}
git config user.name "$git_user"
git config user.email "$git_email"
echo "✅ Git用户配置完成: $git_user <$git_email>"
# 添加文件
echo ""
echo "📝 添加文件到Git..."
git add .gitignore
git add README-DEPLOYMENT.md
git add USAGE-GUIDE.md
git add SUMMARY.md
git add QUICK-REFERENCE.md
git add config/cluster-vars.yml.example
git add scripts/
git add demo-gitops-update.sh
git add init-git-repo.sh
# 检查是否有inventory文件
if [ -f k3s-ansible/inventory/hosts.ini ]; then
git add k3s-ansible/inventory/hosts.ini
fi
# 提交
echo ""
echo "💾 创建初始提交..."
git commit -m "Initial commit: K3s deployment configuration
- 添加部署脚本和配置模板
- 添加完整的使用文档
- 配置.gitignore排除敏感信息
- 支持幂等性部署
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
echo ""
echo "✅ Git仓库初始化完成"
echo ""
echo "📊 当前状态:"
git status
echo ""
echo "📝 下一步:"
echo ""
echo "选项1: 推送到Gitea内部"
echo " 1. 在Gitea创建仓库 'k3s-deployment'"
echo " 2. 运行: git remote add origin http://8.216.38.248:32158/k3s-apps/k3s-deployment.git"
echo " 3. 运行: git push -u origin main"
echo ""
echo "选项2: 推送到GitHub/GitLab外部"
echo " 1. 在GitHub/GitLab创建仓库"
echo " 2. 运行: git remote add origin <your-repo-url>"
echo " 3. 运行: git push -u origin main"
echo ""
echo "选项3: 仅本地使用"
echo " 无需额外操作已经可以使用Git进行版本控制"
echo ""
echo "💡 提示:"
echo " - config/cluster-vars.yml 包含敏感信息已排除在Git之外"
echo " - 可以使用 'git log' 查看提交历史"
echo " - 可以使用 'git diff' 查看文件变更"
echo ""