2019-06-28 12:28:47 +02:00
|
|
|
- block:
|
|
|
|
- name: create t3.nano instance with cpu_options
|
|
|
|
ec2_instance:
|
|
|
|
name: "{{ resource_prefix }}-test-t3nano-1-threads-per-core"
|
2019-10-21 14:55:44 +02:00
|
|
|
image_id: "{{ ec2_ami_image }}"
|
2019-06-28 12:28:47 +02:00
|
|
|
tags:
|
|
|
|
TestId: "{{ resource_prefix }}"
|
|
|
|
vpc_subnet_id: "{{ testing_subnet_a.subnet.id }}"
|
|
|
|
instance_type: t3.nano
|
|
|
|
cpu_options:
|
|
|
|
core_count: 1
|
|
|
|
threads_per_core: 1
|
|
|
|
wait: false
|
|
|
|
register: instance_creation
|
2018-08-20 12:49:00 +02:00
|
|
|
|
2019-06-28 12:28:47 +02:00
|
|
|
- name: instance with cpu_options created with the right options
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- instance_creation is success
|
|
|
|
- instance_creation is changed
|
2018-08-20 12:49:00 +02:00
|
|
|
|
2019-06-28 12:28:47 +02:00
|
|
|
- name: modify cpu_options on existing instance (warning displayed)
|
|
|
|
ec2_instance:
|
|
|
|
state: present
|
|
|
|
name: "{{ resource_prefix }}-test-t3nano-1-threads-per-core"
|
2019-10-21 14:55:44 +02:00
|
|
|
image_id: "{{ ec2_ami_image }}"
|
2019-06-28 12:28:47 +02:00
|
|
|
tags:
|
|
|
|
TestId: "{{ resource_prefix }}"
|
|
|
|
vpc_subnet_id: "{{ testing_subnet_a.subnet.id }}"
|
|
|
|
instance_type: t3.nano
|
|
|
|
cpu_options:
|
|
|
|
core_count: 1
|
|
|
|
threads_per_core: 2
|
|
|
|
wait: false
|
|
|
|
register: cpu_options_update
|
|
|
|
ignore_errors: yes
|
2018-08-20 12:49:00 +02:00
|
|
|
|
2019-10-21 14:55:44 +02:00
|
|
|
- name: "fact presented ec2 instance"
|
|
|
|
ec2_instance_info:
|
|
|
|
filters:
|
|
|
|
"tag:Name": "{{ resource_prefix }}-test-t3nano-1-threads-per-core"
|
|
|
|
register: presented_instance_fact
|
|
|
|
|
2019-06-28 12:28:47 +02:00
|
|
|
- name: modify cpu_options has no effect on existing instance
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- cpu_options_update is success
|
|
|
|
- cpu_options_update is not changed
|
2019-10-21 14:55:44 +02:00
|
|
|
- "{{ presented_instance_fact.instances | length }} > 0"
|
|
|
|
- "'{{ presented_instance_fact.instances.0.state.name }}' in ['running','pending']"
|
|
|
|
- "{{ presented_instance_fact.instances.0.cpu_options.core_count }} == 1"
|
|
|
|
- "{{ presented_instance_fact.instances.0.cpu_options.threads_per_core }} == 1"
|
2018-10-11 20:21:01 +02:00
|
|
|
|
2019-06-28 12:28:47 +02:00
|
|
|
- name: create t3.nano instance with cpu_options(check mode)
|
|
|
|
ec2_instance:
|
|
|
|
name: "{{ resource_prefix }}-test-t3nano-1-threads-per-core-checkmode"
|
2019-10-21 14:55:44 +02:00
|
|
|
image_id: "{{ ec2_ami_image }}"
|
2019-06-28 12:28:47 +02:00
|
|
|
tags:
|
|
|
|
TestId: "{{ resource_prefix }}"
|
|
|
|
vpc_subnet_id: "{{ testing_subnet_a.subnet.id }}"
|
|
|
|
instance_type: t3.nano
|
|
|
|
cpu_options:
|
|
|
|
core_count: 1
|
|
|
|
threads_per_core: 1
|
|
|
|
check_mode: yes
|
2018-10-11 20:21:01 +02:00
|
|
|
|
2019-06-28 12:28:47 +02:00
|
|
|
- name: "fact checkmode ec2 instance"
|
|
|
|
ec2_instance_info:
|
|
|
|
filters:
|
|
|
|
"tag:Name": "{{ resource_prefix }}-test-t3nano-1-threads-per-core-checkmode"
|
|
|
|
register: checkmode_instance_fact
|
2018-10-11 20:21:01 +02:00
|
|
|
|
2019-06-28 12:28:47 +02:00
|
|
|
- name: "Confirm existence of instance id."
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "{{ checkmode_instance_fact.instances | length }} == 0"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: Terminate instances
|
|
|
|
ec2_instance:
|
|
|
|
filters:
|
|
|
|
tag:TestId: "{{ resource_prefix }}"
|
|
|
|
state: absent
|
|
|
|
wait: false
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|