Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
f183a585
Commit
f183a585
authored
Jun 27, 2023
by
魏灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化ansible hosts
parent
8a8a85aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
src/main.go
src/main.go
+16
-0
src/router/automatedmaintenrouter.go
src/router/automatedmaintenrouter.go
+1
-0
No files found.
src/main.go
View file @
f183a585
...
...
@@ -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
())
}
}
}
src/router/automatedmaintenrouter.go
View file @
f183a585
...
...
@@ -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"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment