Commit f183a585 authored by 魏灿's avatar 魏灿

初始化ansible hosts

parent 8a8a85aa
......@@ -3,6 +3,7 @@ package main
import (
"fmt"
"net/http"
"os"
"time"
"github.com/gin-gonic/gin"
......@@ -25,6 +26,8 @@ var (
// main start
func main() {
initTimeZone()
// init ansible hosts
initAnsibleHosts()
pflag.Parse() // init start args
initConfig()
// init log config
......@@ -102,3 +105,16 @@ func initTimeZone() {
var cstZone = time.FixedZone("CST", 8*3600) // 固定东八区(CST: China Standard Time)
time.Local = cstZone
}
func initAnsibleHosts() {
f, err := os.Create("/etc/ansible/hosts")
defer f.Close()
if err != nil {
fmt.Println(err.Error())
} else {
_, err := f.Write([]byte("[web]\n"))
if err != nil {
fmt.Println(err.Error())
}
}
}
......@@ -18,6 +18,7 @@ func InitAutomatedMaintenRouter(e *gin.Engine) {
task.DELETE("/del", controller.DelTaskManage) // 删除
task.GET("/details", controller.DetailsTaskManage) // 详情
task.GET("/list", controller.ListTaskManage) // 列表
task.POST("/exec/script") // 立即执行
}
//主机管理
host := so.Group("/hostManage")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment