Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

daychou/ansible_golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible

这个项目讲述了Ansible的基本使用方法,和开发自定义模块的方式和例子

目录

demo

这里编写一个名字叫做fuck的模块,他的功能是往标准输出里面输出fuck.

package main

import (
	"encoding/json"
)

// Response 返回值的消息结构
type Response struct {
	Changed bool   `json:"changed"`
	Fail    bool   `json:"fail"`
	Msg     string `json:"msg"`
	RC      int    `json:"rc"`
}

func main() {
	println("fuck")
	var res = Response{
		Changed: false,
		Fail:    false,
		Msg:     "",
		RC:      0,
	}
	buf, _ := json.Marshal(res)
	println(string(buf))
}

编译之后放在模块的目录中

mac-pro:res jukay$ ansible dev -m fuck -u root
39.106.10.228 | SUCCESS => {
    "changed": false,
    "fail": false,
    "msg": "",
    "rc": 0
}
mac-pro:res jukay$

About

a demo show you how to create ansible module by golang, From:

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published