Skip to content

Commit

Permalink
feat: support tools install
Browse files Browse the repository at this point in the history
  • Loading branch information
ysicing committed May 5, 2020
1 parent e6f5fdb commit ebcdaa9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ var installNfs = &cobra.Command{
},
}

var installTools = &cobra.Command{
Use: "tools",
Short: "tools",
Run: func(cmd *cobra.Command, args []string) {
klog.Info("🎉 安装 tools")
install.ToolsInstall()
},
}

func init() {
rootCmd.AddCommand(installCmd)
installCmd.PersistentFlags().StringVar(&install.SSHConfig.User, "user", "root", "管理员")
Expand All @@ -57,5 +66,5 @@ func init() {
installNfs.PersistentFlags().StringVar(&install.NfsPath, "nfspath", "/k8sdata", "nfs路径")
installNfs.PersistentFlags().StringVar(&install.DefaultSc, "nfssc", "nfs-data", "默认nfs storageclass")

installCmd.AddCommand(installDocker, installK8s, installNfs)
installCmd.AddCommand(installDocker, installTools, installK8s, installNfs)
}
22 changes: 22 additions & 0 deletions install/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// MIT License
// Copyright (c) 2019 ysicing <i@ysicing.me>

package install

import (
"fmt"
)

func ToolsInstall() {
i := InstallConfig{
Hosts: Hosts,
}
i.ToolsInstall()
}

func (i *InstallConfig) ToolsInstall() {
for _, ip := range i.Hosts {
toolscmd := fmt.Sprintf("docker run --rm -v /usr/local/bin:/sysdir ysicing/tools tar zxf /pkg.tgz -C /sysdir")
SSHConfig.Cmd(ip, toolscmd)
}
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2
0.3

0 comments on commit ebcdaa9

Please sign in to comment.