【问题标题】:Ansible aws_eip: 'unsupported parameter for module: device_id'Ansible aws_eip:“模块不支持的参数:device_id”
【发布时间】:2017-03-21 10:32:30
【问题描述】:

我正在尝试使用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 以外的其他东西。我应该使用什么?

【问题讨论】:

    标签: ansible elastic-ip


    【解决方案1】:

    显然文档中的示例是错误的。您应该使用instance_id 而不是device_ip。这就是你的任务应该是什么样子(注意"{{ ec2['tagged_instances'][0]['id'] }}" 是存储实例 id 的 ansible 变量):

    - name: associate an elastic IP with an instance
      ec2_eip:
        region: 'us-west-2'
        instance_id: "{{ ec2['tagged_instances'][0]['id'] }}"
        ip: "{{ elastic_ip }}"
    

    【讨论】:

    • 每个模块的参数都有版本支持说明。对于device_id,它是version_added: "2.0"。考虑升级您的 Ansible 版本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-14
    • 2021-04-30
    相关资源
    最近更新 更多