cheliequan
2023-05-31 d3a63ffbec643f7a2746dfe2db2313492ef163af
src/rancher/rancher.go
@@ -6,11 +6,24 @@
   "basic.com/aps/aps_deploy.git/src/util"
)
type RancherConfig struct {
type Node struct {
   Roles       []string `json:"roles"`
   IP          string   `json:"ip"`
   SSHUsername string   `json:"sshUsername"`
   SSHPassword string   `json:"sshPassword"`
   SSHPort     int      `json:"sshPort"`
}
type RancherClusterConfig struct {
   RancherURL  string `json:"rancherURL"`
   BearerToken string `json:"bearerToken"`
   ClusterName string   `mapstructure:"ClusterName"`
   Nodes       []Node   `mapstructure:"Nodes"`
}
func isRancherInstalled(ip, username, password string, sshPort int) (bool, error) {
   // 检查Rancher容器是否已运行
   checkRancherCommand := "sudo docker ps --format '{{.Image}}' | grep -q rancher/rancher:v2.5.17"