summaryrefslogtreecommitdiff
path: root/test/integration/targets/incidental_ec2_instance/roles/ec2_instance/tasks/version_fail.yml
blob: 67370ebe37c021dde6011e003e82fb7f6da52954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- block:
  - name: "create t3.nano with cpu options (fails gracefully)"
    ec2_instance:
      state: present
      name: "ansible-test-{{ resource_prefix | regex_search('([0-9]+)$') }}-ec2"
      image_id: "{{ ec2_ami_image }}"
      instance_type: "t3.nano"
      cpu_options:
          core_count: 1
          threads_per_core: 1
      tags:
        TestId: "{{ ec2_instance_tag_TestId }}"
    register: ec2_instance_cpu_options_creation
    ignore_errors: yes

  - name: "check that graceful error message is returned when creation with cpu_options and old botocore"
    assert:
      that:
        - ec2_instance_cpu_options_creation.failed
        - 'ec2_instance_cpu_options_creation.msg == "cpu_options is only supported with botocore >= 1.10.16"'

  always:
  - name: "Terminate version_fail instances"
    ec2_instance:
      state: absent
      filters:
        "tag:TestId": "{{ ec2_instance_tag_TestId }}"
      wait: yes
    ignore_errors: yes