From 8099fcb823eb11caeb1b7b82efaf38dd78ebeb22 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Mon, 12 Feb 2024 11:57:41 +0100 Subject: [PATCH 1/4] chore: update default values --- .../agent-smoke-kmodule/molecule.yml.template | 56 +++++------------- .../molecule.yml.template | 58 +++++-------------- .../molecule.yml.template | 18 ------ .../molecule.yml.template | 54 ++++------------- molecule/resources/playbooks/create.yml | 9 ++- 5 files changed, 46 insertions(+), 149 deletions(-) diff --git a/molecule/agent-smoke-kmodule/molecule.yml.template b/molecule/agent-smoke-kmodule/molecule.yml.template index d2b69a97..502844ba 100644 --- a/molecule/agent-smoke-kmodule/molecule.yml.template +++ b/molecule/agent-smoke-kmodule/molecule.yml.template @@ -13,23 +13,11 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: alma-9-x86_64 image: ami-07bc349330a94a4e3 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: debian-10-x86_64 image: ami-0e1e938b3f38e7558 instance_type: ${INSTANCE_TYPE_X86} @@ -70,51 +58,33 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/xvda - ebs: - volume_size: 5 - delete_on_termination: true - volume_type: gp3 - name: amazon-2023-x86_64 image: ami-0d4d826d70d17642f instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - # - name: centos8-x86 - # boot_wait_seconds: 180 - # image: ami-03dbb661dc3a9b6a5 - # instance_type: ${INSTANCE_TYPE_X86} - # region: ${REGION} - # vpc_subnet_id: ${VPC_SUBNET_ID} - # - name: centos8-aarch - # boot_wait_seconds: 180 - # image: ami-0fbdd12bd5a9c2e6f - # instance_type: ${INSTANCE_TYPE_AARCH} - # region: ${REGION} - # vpc_subnet_id: ${VPC_SUBNET_ID} - - name: rocky8 + - name: centos8-x86_64 + boot_wait_seconds: 180 + image: ami-03dbb661dc3a9b6a5 + instance_type: ${INSTANCE_TYPE_X86} + region: ${REGION} + vpc_subnet_id: ${VPC_SUBNET_ID} + - name: centos8-arm64 + boot_wait_seconds: 180 + image: ami-0fbdd12bd5a9c2e6f + instance_type: ${INSTANCE_TYPE_AARCH} + region: ${REGION} + vpc_subnet_id: ${VPC_SUBNET_ID} + - name: rocky8-x86_64 image: ami-093bfdaaa5ea85b41 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: rocky-9-x86_64 image: ami-021a1f96fec61f4e9 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: centos-7-x86_64 image: ami-0aedf6b1cb669b4c7 instance_type: ${INSTANCE_TYPE_X86} diff --git a/molecule/agent-smoke-legacy-ebpf/molecule.yml.template b/molecule/agent-smoke-legacy-ebpf/molecule.yml.template index 91cece8d..c5770831 100644 --- a/molecule/agent-smoke-legacy-ebpf/molecule.yml.template +++ b/molecule/agent-smoke-legacy-ebpf/molecule.yml.template @@ -13,23 +13,11 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: alma-9-x86_64 image: ami-07bc349330a94a4e3 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: debian-10-x86_64 image: ami-0e1e938b3f38e7558 instance_type: ${INSTANCE_TYPE_X86} @@ -60,7 +48,7 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - - name: ubuntu-2204-amd64 + - name: ubuntu-2204-arm64 image: ami-01ec7354bd709968b instance_type: ${INSTANCE_TYPE_AARCH} region: ${REGION} @@ -70,51 +58,33 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/xvda - ebs: - volume_size: 5 - delete_on_termination: true - volume_type: gp3 - name: amazon-2023-x86_64 image: ami-0d4d826d70d17642f instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - # - name: centos8-x86 - # boot_wait_seconds: 180 - # image: ami-03dbb661dc3a9b6a5 - # instance_type: ${INSTANCE_TYPE_X86} - # region: ${REGION} - # vpc_subnet_id: ${VPC_SUBNET_ID} - # - name: centos8-aarch - # boot_wait_seconds: 180 - # image: ami-0fbdd12bd5a9c2e6f - # instance_type: ${INSTANCE_TYPE_AARCH} - # region: ${REGION} - # vpc_subnet_id: ${VPC_SUBNET_ID} - - name: rocky8 + - name: centos8-x86_64 + boot_wait_seconds: 180 + image: ami-03dbb661dc3a9b6a5 + instance_type: ${INSTANCE_TYPE_X86} + region: ${REGION} + vpc_subnet_id: ${VPC_SUBNET_ID} + - name: centos8-arm64 + boot_wait_seconds: 180 + image: ami-0fbdd12bd5a9c2e6f + instance_type: ${INSTANCE_TYPE_AARCH} + region: ${REGION} + vpc_subnet_id: ${VPC_SUBNET_ID} + - name: rocky8-x86_64 image: ami-093bfdaaa5ea85b41 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: rocky-9-x86_64 image: ami-021a1f96fec61f4e9 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 provisioner: lint: name: ansible-lint diff --git a/molecule/agent-smoke-universal-ebpf/molecule.yml.template b/molecule/agent-smoke-universal-ebpf/molecule.yml.template index 91350beb..e151c9d9 100644 --- a/molecule/agent-smoke-universal-ebpf/molecule.yml.template +++ b/molecule/agent-smoke-universal-ebpf/molecule.yml.template @@ -13,23 +13,11 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: alma-9-x86_64 image: ami-07bc349330a94a4e3 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: debian-11-x86_64 image: ami-0fd320e6b2de9e34a instance_type: ${INSTANCE_TYPE_X86} @@ -65,12 +53,6 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 provisioner: lint: name: ansible-lint diff --git a/molecule/agent-uninstall-clean-all/molecule.yml.template b/molecule/agent-uninstall-clean-all/molecule.yml.template index aec73542..b4aad408 100644 --- a/molecule/agent-uninstall-clean-all/molecule.yml.template +++ b/molecule/agent-uninstall-clean-all/molecule.yml.template @@ -13,23 +13,11 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: alma-9-x86_64 image: ami-07bc349330a94a4e3 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: debian-10-x86_64 image: ami-0e1e938b3f38e7558 instance_type: ${INSTANCE_TYPE_X86} @@ -70,51 +58,33 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/xvda - ebs: - volume_size: 5 - delete_on_termination: true - volume_type: gp3 - name: amazon-2023-x86_64 image: ami-0d4d826d70d17642f instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - # - name: centos8-x86 - # boot_wait_seconds: 180 - # image: ami-03dbb661dc3a9b6a5 - # instance_type: ${INSTANCE_TYPE_X86} - # region: ${REGION} - # vpc_subnet_id: ${VPC_SUBNET_ID} - # - name: centos8-aarch - # boot_wait_seconds: 180 - # image: ami-0fbdd12bd5a9c2e6f - # instance_type: ${INSTANCE_TYPE_AARCH} - # region: ${REGION} - # vpc_subnet_id: ${VPC_SUBNET_ID} + - name: centos8-x86 + boot_wait_seconds: 180 + image: ami-03dbb661dc3a9b6a5 + instance_type: ${INSTANCE_TYPE_X86} + region: ${REGION} + vpc_subnet_id: ${VPC_SUBNET_ID} + - name: centos8-aarch + boot_wait_seconds: 180 + image: ami-0fbdd12bd5a9c2e6f + instance_type: ${INSTANCE_TYPE_AARCH} + region: ${REGION} + vpc_subnet_id: ${VPC_SUBNET_ID} - name: rocky8 image: ami-093bfdaaa5ea85b41 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: rocky-9-x86_64 image: ami-021a1f96fec61f4e9 instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - volumes: - - device_name: /dev/sda1 - ebs: - volume_size: 30 - delete_on_termination: true - volume_type: gp3 - name: centos-7-x86_64 image: ami-0aedf6b1cb669b4c7 instance_type: ${INSTANCE_TYPE_X86} diff --git a/molecule/resources/playbooks/create.yml b/molecule/resources/playbooks/create.yml index 5f72a8a6..7d2d0904 100644 --- a/molecule/resources/playbooks/create.yml +++ b/molecule/resources/playbooks/create.yml @@ -20,7 +20,7 @@ # Platform settings handling default_assign_public_ip: true default_aws_profile: "{{ lookup('env', 'AWS_PROFILE') }}" - default_boot_wait_seconds: 120 + default_boot_wait_seconds: 180 default_instance_type: t3a.medium default_key_inject_method: cloud-init # valid values: [cloud-init, ec2] default_key_name: "molecule-{{ run_config.run_id }}" @@ -70,7 +70,12 @@ region: "" security_groups: [] tags: {} - volumes: [] + volumes: + - device_name: /dev/sda1 + ebs: + volume_size: 30 + delete_on_termination: true + volume_type: gp3 vpc_id: "" vpc_subnet_id: "" From 2c6ce3ba7d745635016f10b4503d1995a288144a Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Mon, 12 Feb 2024 12:01:35 +0100 Subject: [PATCH 2/4] chore: reorganize kernel update process --- molecule/resources/playbooks/prepare.yml | 36 +++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/molecule/resources/playbooks/prepare.yml b/molecule/resources/playbooks/prepare.yml index f1dea7a5..b8c65d2e 100644 --- a/molecule/resources/playbooks/prepare.yml +++ b/molecule/resources/playbooks/prepare.yml @@ -29,22 +29,24 @@ when: update_debian_kernel.changed when: ansible_distribution == "Debian" - # See https://almalinux.org/blog/2023-12-20-almalinux-8-key-update/ - - name: Import AlmaLinux 8 GPG key - ansible.builtin.rpm_key: - state: present - key: https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux - when: - - ansible_distribution == 'AlmaLinux' - - ansible_distribution_major_version == '8' + - name: Prepare Alma, Fedora, and Rocky hosts + block: + # See https://almalinux.org/blog/2023-12-20-almalinux-8-key-update/ + - name: Import AlmaLinux 8 GPG key + ansible.builtin.rpm_key: + state: present + key: https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux + when: + - ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '8' - - name: Update Alma, Fedora, and Rocky kernels - ansible.builtin.dnf: - name: kernel - state: latest - register: update_kernel - when: ansible_distribution in ['AlmaLinux', 'Fedora', 'Rocky'] + - name: Update kernels + ansible.builtin.dnf: + name: kernel + state: latest + register: update_kernel - - name: Reboot systems after kernel update (if required) - ansible.builtin.reboot: - when: update_kernel.changed + - name: Reboot systems after kernel update (if required) + ansible.builtin.reboot: + when: update_kernel.changed + when: ansible_distribution in ['AlmaLinux', 'Fedora', 'Rocky'] From 75dc0c1424178cba65d2c45337306d219fcef132 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Mon, 12 Feb 2024 12:57:43 +0100 Subject: [PATCH 3/4] fix: CentOS 8 AMI --- molecule/agent-smoke-kmodule/molecule.yml.template | 4 ++-- molecule/agent-smoke-legacy-ebpf/molecule.yml.template | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/molecule/agent-smoke-kmodule/molecule.yml.template b/molecule/agent-smoke-kmodule/molecule.yml.template index 502844ba..349b99ae 100644 --- a/molecule/agent-smoke-kmodule/molecule.yml.template +++ b/molecule/agent-smoke-kmodule/molecule.yml.template @@ -65,13 +65,13 @@ platforms: vpc_subnet_id: ${VPC_SUBNET_ID} - name: centos8-x86_64 boot_wait_seconds: 180 - image: ami-03dbb661dc3a9b6a5 + image: ami-0aa6883376595a33c instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - name: centos8-arm64 boot_wait_seconds: 180 - image: ami-0fbdd12bd5a9c2e6f + image: ami-02be6a70c24b1ae91 instance_type: ${INSTANCE_TYPE_AARCH} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} diff --git a/molecule/agent-smoke-legacy-ebpf/molecule.yml.template b/molecule/agent-smoke-legacy-ebpf/molecule.yml.template index c5770831..c3547f21 100644 --- a/molecule/agent-smoke-legacy-ebpf/molecule.yml.template +++ b/molecule/agent-smoke-legacy-ebpf/molecule.yml.template @@ -65,13 +65,13 @@ platforms: vpc_subnet_id: ${VPC_SUBNET_ID} - name: centos8-x86_64 boot_wait_seconds: 180 - image: ami-03dbb661dc3a9b6a5 + image: ami-0aa6883376595a33c instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} - name: centos8-arm64 boot_wait_seconds: 180 - image: ami-0fbdd12bd5a9c2e6f + image: ami-02be6a70c24b1ae91 instance_type: ${INSTANCE_TYPE_AARCH} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} From 407e6dd2f87e7fc82b34b8d4bb95c542a9803c2c Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Mon, 12 Feb 2024 14:34:23 +0100 Subject: [PATCH 4/4] chore: revert changes on volume for Amazon distros --- molecule/agent-smoke-kmodule/molecule.yml.template | 6 ++++++ molecule/agent-smoke-legacy-ebpf/molecule.yml.template | 6 ++++++ molecule/agent-uninstall-clean-all/molecule.yml.template | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/molecule/agent-smoke-kmodule/molecule.yml.template b/molecule/agent-smoke-kmodule/molecule.yml.template index 349b99ae..47d8efc8 100644 --- a/molecule/agent-smoke-kmodule/molecule.yml.template +++ b/molecule/agent-smoke-kmodule/molecule.yml.template @@ -58,6 +58,12 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} + volumes: + - device_name: /dev/xvda + ebs: + volume_size: 5 + delete_on_termination: true + volume_type: gp3 - name: amazon-2023-x86_64 image: ami-0d4d826d70d17642f instance_type: ${INSTANCE_TYPE_X86} diff --git a/molecule/agent-smoke-legacy-ebpf/molecule.yml.template b/molecule/agent-smoke-legacy-ebpf/molecule.yml.template index c3547f21..471c66e2 100644 --- a/molecule/agent-smoke-legacy-ebpf/molecule.yml.template +++ b/molecule/agent-smoke-legacy-ebpf/molecule.yml.template @@ -58,6 +58,12 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} + volumes: + - device_name: /dev/xvda + ebs: + volume_size: 5 + delete_on_termination: true + volume_type: gp3 - name: amazon-2023-x86_64 image: ami-0d4d826d70d17642f instance_type: ${INSTANCE_TYPE_X86} diff --git a/molecule/agent-uninstall-clean-all/molecule.yml.template b/molecule/agent-uninstall-clean-all/molecule.yml.template index b4aad408..d7eff330 100644 --- a/molecule/agent-uninstall-clean-all/molecule.yml.template +++ b/molecule/agent-uninstall-clean-all/molecule.yml.template @@ -58,6 +58,12 @@ platforms: instance_type: ${INSTANCE_TYPE_X86} region: ${REGION} vpc_subnet_id: ${VPC_SUBNET_ID} + volumes: + - device_name: /dev/xvda + ebs: + volume_size: 5 + delete_on_termination: true + volume_type: gp3 - name: amazon-2023-x86_64 image: ami-0d4d826d70d17642f instance_type: ${INSTANCE_TYPE_X86}