ansible 错误记录

ansible 错误记录

ansible 版本
ansible 2.2.1.0
lineinfile 模块
在 ansible 2.2.1 版本中  lineinfile 模板还未识别 path 参数 ,报错如下

命令为:
[root@master ~]$ ansible node -m lineinfile -a ' \ 
  path="/etc/my.cnf" \
  regexp="^binlog-format" \
  line="binlog-format = row"'
执行报错如下:
nova1 | FAILED! => {
    "changed": false, 
    "failed": true, 
    "msg": "unsupported parameter for module: path"
}

正确参数为
[root@master ~]$ ansible node -m lineinfile -a ' \ 
  dest="/etc/my.cnf" \
  regexp="^binlog-format" \
  line="binlog-format = row"'
执行成功。
nova1 | SUCCESS => {
    "backup": "", 
    "changed": true, 
    "msg": "line replaced"
}
将 path 参数换为 dest;
原因是: 
在ansible 2.8版本之前还未更新 path参数,在2.8版本之后才将 dest 更改为path

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值