2025-04-10 11:26:55 +08:00

44 lines
1.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 颜色设置
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # 无颜色
# 显示欢迎信息
echo -e "${BLUE}====================================================${NC}"
echo -e "${BLUE} OpenGauss Docker 单节点部署工具 ${NC}"
echo -e "${BLUE}====================================================${NC}"
# 检查ansible是否安装
if ! command -v ansible &> /dev/null; then
echo -e "${RED}错误: 未检测到ansible命令, 请先安装ansible${NC}"
echo "安装命令: pip install ansible"
exit 1
fi
# 检查inventory.ini文件是否已经配置
if grep -q "<your_server_ip>" inventory.ini; then
echo -e "${RED}错误: 请先修改inventory.ini文件配置服务器IP、用户名和SSH端口${NC}"
exit 1
fi
# 运行ansible playbook
echo -e "${GREEN}开始部署 OpenGauss Docker 单节点...${NC}"
ansible-playbook -i inventory.ini deploy.yml
# 检查部署结果
if [ $? -eq 0 ]; then
echo -e "${GREEN}OpenGauss Docker 单节点部署成功!${NC}"
echo -e "${GREEN}以下是连接信息:${NC}"
echo -e "${GREEN} 主机: 目标服务器IP${NC}"
echo -e "${GREEN} 端口: 8888${NC}"
echo -e "${GREEN} 用户: gaussdb${NC}"
echo -e "${GREEN} 密码: 在vars/main.yml中配置的密码${NC}"
echo -e "${GREEN} 连接命令: gsql -d postgres -U gaussdb -W'您的密码' -h 服务器IP -p 8888${NC}"
else
echo -e "${RED}OpenGauss Docker 单节点部署失败!${NC}"
echo -e "${RED}请检查错误输出并尝试修复问题.${NC}"
exit 1
fi