【问题标题】:Ansible apt module - "unsupported parameter for module: “name"Ansible apt 模块 - “模块不支持的参数:“名称”
【发布时间】:2016-10-12 19:53:21
【问题描述】:

Ansible 版本 2.1.2.0(自制软件,macOS - 已删除任何以前的版本)

ansible myserver -m apt -a “name=backup2l,state=present” --ask-pass

返回此错误:

myserver | FAILED! => {
    "changed": false,
    "failed": true,
    "msg": "unsupported parameter for module: “name"
}

根据the examples,这似乎是正确的语法:

# Install the package "foo"
- apt: name=foo state=present

我尝试将 namestate 的值用单引号括起来,同时在参数之间使用空格(它不喜欢这样 - “错误!缺少目标主机”)。

有什么想法吗?

【问题讨论】:

    标签: ansible


    【解决方案1】:

    ansible 参数由空格分隔,如命令行,而不是函数调用。

    试试:

    ansible myserver -m apt -a “name=backup2l state=present” --ask-pass
    

    【讨论】:

    • 这是一个报价问题。还是谢谢。
    【解决方案2】:

    由于使用“智能引号”而不是“正则引号”,这是由于首先在我的笔记应用程序中输入命令然后复制并粘贴到 iTerm 中造成的。

    注意:您收到的错误消息取决于您尝试执行的操作 - 如果您使用 -a 运行单个命令,Ansible 会说“没有这样的文件或目录”。

    Mac 用户解决方案:

    系统偏好设置>键盘>文本>取消选中“使用智能引号和破折号”。

    如果您愿意,请投票:iTerm2 feature request

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-21
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多