Skip to content

Commit a209d85

Browse files
committed
Add support for Aarch64 instances
1 parent 4ebaafd commit a209d85

File tree

12 files changed

+67
-55
lines changed

12 files changed

+67
-55
lines changed

group_vars/all.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ aws_tags_kms_database:
220220
# -------- AMI --------
221221
# -----------------------
222222

223-
# AMI Name search pattern matching official CentOS 7 Marketplace AMI
223+
# AMI Name search pattern matching official Rocky linux 9 Marketplace AMI
224224
# Warning! You need to be subscribed to it first!
225-
aws_ami_base_marketplace_name: "*b7ee8a69-ee97-4a49-9e68-afaee216db2e*"
225+
aws_ami_base_marketplace_name: "Rocky-9-EC2-*"
226226

227227
# Whether to kill previously created builder or reuse it on next run
228228
aws_ami_build_force_fresh_builder: no
+27-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1+
ami_facts_instance: ""
2+
ami_facts_architecture: "{{ ami_facts_architecture_map[ami_facts_instance.split('.')[0]] }}"
3+
4+
ami_facts_architecture_map:
5+
t3: x86_64
6+
m6a: x86_64
7+
m6i: x86_64
8+
m6g: arm64
9+
t4g: arm64
10+
c6g: arm64
11+
c5: x86_64
12+
c5a: x86_64
13+
c6i: x86_64
14+
c6a: x86_64
15+
c7g: arm64
16+
r6a: x86_64
17+
r6i: x86_64
18+
r6g: arm64
19+
r5: x86_64
20+
r5a: x86_64
21+
r5b: x86_64
22+
123
ami_facts_common_filters:
224
state: "available"
3-
architecture: "x86_64"
4-
5-
# Deprecated - CentOS no longer updates the Marketplace AMIs
6-
# ami_facts_clean_base_filters:
7-
# name: "{{ aws_ami_base_marketplace_name }}"
8-
# is-public: "true"
9-
# owner-alias: "aws-marketplace"
10-
11-
# The image id of CentOS AWS images needs to be hardcoded and manually update now.
12-
# Warning! The ids are different for each region, for no we use a hardcoded
13-
# values for eu-central-1.
14-
# Find the latest CentOS ami ids here: https://www.centos.org/download/aws-images/
15-
ami_centos7_id:
16-
# eu-central-1: ami-08b6d44b4f6f7b279 # original
17-
eu-central-1: ami-06a38f9c5f75d09bd # rocky 9.0.20220706
18-
19-
ami_base_system_image_id: "{{ ami_centos7_id[aws_region | default('eu-central-1')] }}"
25+
architecture: "{{ ami_facts_architecture }}"
2026

2127
ami_facts_clean_base_filters:
22-
image-id: "{{ ami_base_system_image_id }}"
28+
name: "{{ aws_ami_base_marketplace_name }}"
29+
is-public: "true"
30+
owner-alias: "aws-marketplace"
2331

2432
ami_facts_app_node_tags: "{{ aws_tags_base | combine(aws_tags_role_app) }}"
2533

@@ -35,3 +43,4 @@ ami_facts_app_node_base_filters: >-
3543
}}
3644
3745
ami_facts_app_node_filters: {}
46+
aws_ami_clean_base_info: {}
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
- name: Find clean base AMIs
2-
amazon.aws.ec2_ami_info:
3-
region: "{{ aws_region }}"
4-
filters: "{{ ami_facts_common_filters | combine(ami_facts_clean_base_filters) }}"
5-
register: ami_clean_base_facts
1+
- block:
2+
- name: Find clean base AMIs
3+
amazon.aws.ec2_ami_info:
4+
region: "{{ aws_region }}"
5+
filters: "{{ ami_facts_common_filters | combine(ami_facts_clean_base_filters) }}"
6+
register: ami_clean_base_facts
67

7-
- name: Fail if no clean base AMI is found
8-
fail:
9-
msg: Error! No clean base AMI found!
10-
when: ami_clean_base_facts.images | length == 0
8+
- name: Fail if no clean base AMI is found
9+
fail:
10+
msg: Error! No clean base AMI found!
11+
when: ami_clean_base_facts.images | length == 0
1112

12-
- name: Set latest clean base AMI info fact
13-
set_fact:
14-
aws_ami_clean_base_info: "{{ ami_clean_base_facts.images | sort(attribute='creation_date') | last }}"
13+
- name: Set latest clean base AMI info fact
14+
set_fact:
15+
aws_ami_clean_base_info_best: "{{ ami_clean_base_facts.images | sort(attribute='creation_date') | last }}"
16+
17+
- name: Set base clean AMI facts
18+
set_fact:
19+
aws_ami_clean_base_info: "{{ aws_ami_clean_base_info | combine( {ami_facts_architecture: aws_ami_clean_base_info_best} ) }}"
20+
when: aws_ami_clean_base_info[ami_facts_architecture] is not defined
1521

1622
- name: Set base clean AMI facts
1723
set_fact:
18-
aws_ami_clean_base_id: "{{ aws_ami_clean_base_info.image_id }}"
19-
aws_ami_clean_base_name: "{{ aws_ami_clean_base_info.name }}"
20-
aws_ami_clean_base_location: "{{ aws_ami_clean_base_info.image_location }}"
21-
aws_ami_root_device: "{{ aws_ami_clean_base_info.root_device_name }}"
24+
aws_ami_clean_base_info: "{{ aws_ami_clean_base_info | combine( {ami_facts_instance: aws_ami_clean_base_info[ami_facts_architecture]} ) }}"
2225

2326
- name: Print information about base AMI found
2427
debug:
2528
msg: |
2629
Clean base AMI information
2730
==========================
2831
29-
{{ aws_ami_clean_base_name }} [{{ aws_ami_clean_base_id }}]
30-
({{ aws_ami_clean_base_location }})
31-
32-
--- Details ---
33-
3432
{{ aws_ami_clean_base_info | to_nice_yaml }}

roles/cs.aws-autoscaling/meta/main.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ dependencies:
22
- role: cs.ansible-plugins
33
- role: cs.aws-vpc-facts
44
- role: cs.aws-security-group-facts
5-
- role: cs.aws-ami-facts

roles/cs.aws-facts-all/meta/main.yml

-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ dependencies:
1111
when: aws_facts_gather_node
1212
- role: cs.aws-security-group-facts
1313
when: aws_facts_gather_security_group
14-
- role: cs.aws-ami-facts
15-
when: aws_facts_gather_ami
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dependencies:
2-
- role: cs.aws-ami-facts
2+
- role: cs.aws-ami-facts
3+
ami_facts_instance: "{{ aws_app_builder_node_instance_type }}"

roles/cs.aws-node-persistent/defaults/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
aws_persistent_node_ami_id: "{{ aws_ami_clean_base_id }}"
1+
aws_persistent_node_ami_id: "{{ aws_ami_clean_base_info[aws_persistent_node_instance_type].image_id }}"
22
aws_persistent_node_instance_type: t3a.micro
33
aws_persistent_node_ebs_volume_size: 10
44
aws_ansible_persistent_node_inventory_group: persistent
@@ -13,4 +13,4 @@ aws_persistent_node_security_groups:
1313
aws_persistent_node_ebs_volume_type: "{{ aws_ec2_ebs_volume_type | default('gp3', true) }}"
1414
aws_persistent_node_ebs_gp3_convert: "{{ aws_ec2_ebs_gp3_convert | default(false) }}"
1515
aws_persistent_node_ebs_gp3_iops: "{{ aws_ec2_ebs_gp3_iops | default(3000, true) }}"
16-
aws_persistent_node_ebs_gp3_throughput: "{{ aws_ec2_ebs_gp3_throughput | default(125, true) }}"
16+
aws_persistent_node_ebs_gp3_throughput: "{{ aws_ec2_ebs_gp3_throughput | default(125, true) }}"

roles/cs.aws-node-varnish/defaults/main.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
aws_varnish_node_ami_id: "{{ aws_ami_clean_base_id }}"
1+
aws_varnish_node_ami_id: "{{ aws_ami_clean_base_info[aws_varnish_node_instance_type].image_id }}"
22
aws_varnish_node_instance_type: t3a.micro
33
aws_varnish_node_ebs_volume_size: 10
44
aws_ansible_varnish_node_inventory_group: varnish
@@ -14,4 +14,3 @@ aws_varnish_node_ebs_volume_type: "{{ aws_ec2_ebs_volume_type | default('gp3', t
1414
aws_varnish_node_ebs_gp3_convert: "{{ aws_ec2_ebs_gp3_convert | default(false) }}"
1515
aws_varnish_node_ebs_gp3_iops: "{{ aws_ec2_ebs_gp3_iops | default(3000, true) }}"
1616
aws_varnish_node_ebs_gp3_throughput: "{{ aws_ec2_ebs_gp3_throughput | default(125, true) }}"
17-

roles/cs.varnish/defaults/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ varnish_workspace_client: 64k
6363
varnish_workspace_thread: 4k
6464

6565
# As of varnish 6.0 the default is 48k and lower values cause segfault with our VCL
66-
varnish_thread_pool_stack: 64k
66+
# 128k is minimum for aarch64
67+
varnish_thread_pool_stack: 128k
6768

6869
# Max. number of thread pools that should be at most the number of vCPUs
6970
# See: https://varnish-cache.org/docs/6.0/reference/varnishd.html#thread-pool-max

site.step-10-infrastructure-aws.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@
2929
lb_http_port: "{{ mageops_varnish_port }}"
3030
when: aws_elb_create
3131
- role: cs.aws-ami-facts
32+
ami_facts_instance: "{{ aws_varnish_node_instance_type }}"
33+
- role: cs.aws-ami-facts
34+
ami_facts_instance: "{{ aws_persistent_node_instance_type }}"
3235
- role: cs.aws-node-facts
3336
- role: cs.aws-node-varnish
34-
aws_varnish_node_root_device: "{{ aws_ami_root_device }}"
37+
aws_varnish_node_root_device: "{{ aws_ami_clean_base_info[aws_varnish_node_instance_type].root_device_name }}"
3538
aws_varnish_node_vpc_subnet_id: "{{ aws_vpc_subnet_id }}"
3639
aws_varnish_instance_id: "{{ aws_varnish_node_instance.instance_id | default(false) }}"
3740
when: varnish_standalone
3841
- role: cs.aws-node-persistent
39-
aws_persistent_node_root_device: "{{ aws_ami_root_device }}"
42+
aws_persistent_node_root_device: "{{ aws_ami_clean_base_info[aws_persistent_node_instance_type].root_device_name }}"
4043
aws_persistent_node_vpc_subnet_id: "{{ aws_vpc_subnet_id }}"
4144
aws_persistent_instance_id: "{{ aws_persistent_node_instance.instance_id | default(false) }}"
4245
when: aws_persistent_node_create

site.step-30-builder.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
{{
1818
aws_app_node_base_ami_id_forced | default(
1919
aws_ami_force_clean_build | ternary(
20-
aws_ami_clean_base_id,
21-
aws_ami_app_node_id | default(aws_ami_clean_base_id, true)
20+
aws_ami_clean_base_info[aws_app_builder_node_instance_type].image_id,
21+
aws_ami_app_node_id | default(aws_ami_clean_base_info[aws_app_builder_node_instance_type].image_id, true)
2222
),
2323
true
2424
)
@@ -31,7 +31,7 @@
3131
builder_instance_ssh_key_name: "{{ aws_ec2_ssh_key_name }}"
3232
builder_instance_iam_role: "{{ aws_iam_role_app_node }}"
3333
builder_instance_user_data: "{{ aws_ec2_instance_user_data }}"
34-
builder_instance_root_device: "{{ aws_ami_root_device }}"
34+
builder_instance_root_device: "{{ aws_ami_clean_base_info[aws_app_builder_node_instance_type].root_device_name }}"
3535
builder_instance_security_groups:
3636
- "{{ aws_security_group_app_id }}"
3737
- "{{ aws_security_group_ssh_id }}"

site.step-60-autoscaling.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
gather_facts: no
66
roles:
77
- role: cs.aws-ami-facts
8+
ami_facts_instance: "{{ aws_app_node_instance_type }}"
89
delegate_to: localhost
910
tasks:
1011
- block:
@@ -59,6 +60,9 @@
5960
)
6061
}}
6162
roles:
63+
- role: cs.aws-ami-facts
64+
ami_facts_instance: "{{ aws_app_node_instance_type }}"
65+
delegate_to: localhost
6266
- role: cs.aws-autoscaling
6367
autoscaling_assign_public_ip: yes
6468
autoscaling_loadbalancers: "{{ aws_app_asg_load_balancers }}"

0 commit comments

Comments
 (0)