mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.8 KiB
YAML
90 lines
2.8 KiB
YAML
6 years ago
|
- name: set connection information for all tasks
|
||
|
set_fact:
|
||
|
aws_connection_info: &aws_connection_info
|
||
|
aws_access_key: "{{ aws_access_key }}"
|
||
|
aws_secret_key: "{{ aws_secret_key }}"
|
||
|
security_token: "{{ security_token }}"
|
||
|
region: "{{ aws_region }}"
|
||
|
no_log: true
|
||
|
|
||
6 years ago
|
- name: create t3.nano instance with cpu_options
|
||
6 years ago
|
ec2_instance:
|
||
6 years ago
|
name: "{{ resource_prefix }}-test-t3nano-1-threads-per-core"
|
||
6 years ago
|
image_id: "{{ ec2_ami_image[aws_region] }}"
|
||
|
tags:
|
||
|
TestId: "{{ resource_prefix }}"
|
||
|
vpc_subnet_id: "{{ testing_subnet_a.subnet.id }}"
|
||
6 years ago
|
instance_type: t3.nano
|
||
6 years ago
|
cpu_options:
|
||
|
core_count: 1
|
||
|
threads_per_core: 1
|
||
6 years ago
|
wait: false
|
||
6 years ago
|
<<: *aws_connection_info
|
||
|
register: instance_creation
|
||
|
|
||
|
- name: instance with cpu_options created with the right options
|
||
|
assert:
|
||
|
that:
|
||
|
- instance_creation is success
|
||
|
- instance_creation is changed
|
||
|
|
||
|
- name: modify cpu_options on existing instance (warning displayed)
|
||
|
ec2_instance:
|
||
|
state: present
|
||
6 years ago
|
name: "{{ resource_prefix }}-test-t3nano-1-threads-per-core"
|
||
6 years ago
|
image_id: "{{ ec2_ami_image[aws_region] }}"
|
||
|
tags:
|
||
|
TestId: "{{ resource_prefix }}"
|
||
|
vpc_subnet_id: "{{ testing_subnet_a.subnet.id }}"
|
||
6 years ago
|
instance_type: t3.nano
|
||
6 years ago
|
cpu_options:
|
||
|
core_count: 1
|
||
|
threads_per_core: 2
|
||
6 years ago
|
wait: false
|
||
6 years ago
|
<<: *aws_connection_info
|
||
|
register: cpu_options_update
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: modify cpu_options has no effect on existing instance
|
||
|
assert:
|
||
|
that:
|
||
|
- cpu_options_update is success
|
||
|
- cpu_options_update is not changed
|
||
6 years ago
|
|
||
6 years ago
|
- name: create t3.nano instance with cpu_options(check mode)
|
||
6 years ago
|
ec2_instance:
|
||
6 years ago
|
name: "{{ resource_prefix }}-test-t3nano-1-threads-per-core-checkmode"
|
||
6 years ago
|
image_id: "{{ ec2_ami_image[aws_region] }}"
|
||
|
tags:
|
||
|
TestId: "{{ resource_prefix }}"
|
||
|
vpc_subnet_id: "{{ testing_subnet_a.subnet.id }}"
|
||
6 years ago
|
instance_type: t3.nano
|
||
6 years ago
|
cpu_options:
|
||
|
core_count: 1
|
||
|
threads_per_core: 1
|
||
|
<<: *aws_connection_info
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: "fact presented ec2 instance"
|
||
6 years ago
|
ec2_instance_info:
|
||
6 years ago
|
filters:
|
||
6 years ago
|
"tag:Name": "{{ resource_prefix }}-test-t3nano-1-threads-per-core"
|
||
6 years ago
|
<<: *aws_connection_info
|
||
|
register: presented_instance_fact
|
||
|
|
||
|
- name: "fact checkmode ec2 instance"
|
||
6 years ago
|
ec2_instance_info:
|
||
6 years ago
|
filters:
|
||
6 years ago
|
"tag:Name": "{{ resource_prefix }}-test-t3nano-1-threads-per-core-checkmode"
|
||
6 years ago
|
<<: *aws_connection_info
|
||
|
register: checkmode_instance_fact
|
||
|
|
||
|
- name: "Confirm existence of instance id."
|
||
|
assert:
|
||
|
that:
|
||
|
- "{{ presented_instance_fact.instances | length }} > 0"
|
||
6 years ago
|
- "'{{ presented_instance_fact.instances.0.state.name }}' in ['running','pending']"
|
||
6 years ago
|
- "{{ checkmode_instance_fact.instances | length }} == 0"
|
||
6 years ago
|
- "{{ presented_instance_fact.instances.0.cpu_options.core_count }} == 1"
|
||
|
- "{{ presented_instance_fact.instances.0.cpu_options.threads_per_core }} == 1"
|