我正在尝试使用aws_eip模块的指南将EIP分配给ec2实例。但是由于某种原因,aws_eip模块与device_id
存在一些问题。我使用的是ansible 1.9.4:
TASK: [associate an elastic IP with an instance] ******************************
failed: [localhost] => {"failed": true}
msg: unsupported parameter for module: device_id
FATAL: all hosts have already failed -- aborting
我认为它要我使用除device_id以外的东西。我该怎么用?
答案 0 :(得分:0)
显然,doc中的示例是错误的。您应该使用func init() {
http.HandleFunc("/", net.HandleRequest)
}
func HandleRequest(rw http.ResponseWriter, req *http.Request) {
// Recover panics and send the error.
if origin := req.Header.Get("Origin"); origin != "" {
rw.Header().Set("Access-Control-Allow-Origin", origin)
rw.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
rw.Header().Set("Access-Control-Allow-Headers",
"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization")
}
if req.Method == "OPTIONS" {
return
}
...(normally handling real request)
代替instance_id
。这就是你的任务应该是什么样子(注意device_ip
是存储实例id的ansible变量):
"{{ ec2['tagged_instances'][0]['id'] }}"