instance_initiated_shutdown_behavior=竞价型实例不支持停止

instance_initiated_shutdown_behavior=stop is not supported for spot instances

我正在尝试使用 Ansible 2.8 提供现场实例。当我 运行 我的剧本时,我遇到了以下错误。 "instance_initiated_shutdown_behavior=stop is not supported for spot instances."

然而,奇怪的是,在我的剧本中,我没有指定任何内容来停止 spot 实例。

有谁知道可能导致错误的原因吗?

$ansible-剧本test.yml

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Create an ec2 instance] ************************************************** TASK [Create an ec2 instance] ************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "instance_initiated_shutdown_behavior=stop is not supported for spot instances."} PLAY RECAP ********************************************************************* localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

下面是我执行的 yaml 文件的一部分。

tasks:
  - name: Create an ec2 instance
      ec2:
        spot_price: '0.24'
        spot_wait_timeout: 600
        aws_access_key: "{{ access_key }}"
        aws_secret_key: "{{ secret_key }}"
        region: "{{ region }}"
        keypair: "{{ keypair }}"
        group_id: "{{ group_id}}"
        instance_type: "{{ instance_type }}"
        image: "{{ ami }}"
        wait: yes
        vpc_subnet_id: "{{ subnet_id }}"
        assign_public_ip: yes
        spot_launch_group: report_generators

根据 the fine manualinstance_initiated_shutdown_behavior 默认为 stop,这就是为什么你必须在你的情况下用 instance_initiated_shutdown_behavior: terminate 覆盖它