From 0e77adc8c87f5e2f8d69f72b286f180e49690a29 Mon Sep 17 00:00:00 2001 From: Jacob Hanafin Date: Fri, 26 Jul 2024 14:56:03 -0500 Subject: [PATCH] Add supported platforms --- roles/rke2/molecule/README.md | 47 +++++++++++---- roles/rke2/molecule/rocky-89/molecule.yml | 60 ++++++++++++++++++++ roles/rke2/molecule/rocky-94/molecule.yml | 60 ++++++++++++++++++++ roles/rke2/molecule/sles-15/molecule.yml | 60 ++++++++++++++++++++ roles/rke2/molecule/ubuntu-2204/molecule.yml | 60 ++++++++++++++++++++ roles/rke2/molecule/ubuntu-2404/molecule.yml | 2 - 6 files changed, 275 insertions(+), 14 deletions(-) create mode 100644 roles/rke2/molecule/rocky-89/molecule.yml create mode 100644 roles/rke2/molecule/rocky-94/molecule.yml create mode 100644 roles/rke2/molecule/sles-15/molecule.yml create mode 100644 roles/rke2/molecule/ubuntu-2204/molecule.yml diff --git a/roles/rke2/molecule/README.md b/roles/rke2/molecule/README.md index 0f5a974..72bad79 100644 --- a/roles/rke2/molecule/README.md +++ b/roles/rke2/molecule/README.md @@ -1,4 +1,38 @@ -# Molecule Scenarios +# Molecule Scenarios +| Scenario | Passing | +| ----------- | ------- | +| rocky-89 | False | +| rocky-94 | True | +| ubuntu-2404 | True | +| ubuntu-2204 | True | +| sles-15 | False | + +## template +As the name would imply this is a template scenario, no one is supposed to run this and it will not ever work. The purpose is to prevent other scenarios from having to rewrite or copy from one another, this also allows changes to be shared across all scenarios that are descendants of the template. + +## rocky-94 +The rocky-94 scenario is the simplest possible scenario, with a single Rocky 9.4 master node and a single Rocky 9.4 worker node. + +## rocky-89 +The rocky-89 scenario is the simplest possible scenario, with a single Rocky 8.9 master node and a single Rocky 8.9 worker node. + +## ubuntu-2404 +The ubuntu-2204 scenario is the simplest possible scenario, with a single Ubuntu 24.04 master node and a single Ubuntu 24.04 worker node. + +## ubuntu-2204 +The ubuntu-2404 scenario is the simplest possible scenario, with a single Ubuntu 22.04 master node and a single Ubuntu 22.04 worker node. + + +--- +# Development +## Required ENV Vars +| Name | Purpose | +| --------------------- | ------- | +| AWS_ACCESS_KEY_ID | Access to AWS | +| AWS_SECRET_ACCESS_KEY | Access to AWS | +| VPC_SUBNET_ID | Subnet to assign EC2s to | + +## Summary The molecule test scenarios are based on the cookie cutter ec2 instance and require the molecule plugin here: [molecule-plugin](https://github.com/ansible-community/molecule-plugins), the pip3 `requirements.txt` can be found in this directory while the ansible specfic requirements will be installed automatically when running molecule as a part of the `requirements` stage. As this is an ec2 based scenario an AWS account is needed, you will need to define the following variables either as environment variables or in your aws cli config file (`~/.aws/config`) @@ -19,18 +53,7 @@ It is worth noting that the EC2 driver does not provide a way to login to EC2 in The `vpc_subnet_id` key has been removed as a defined variable and is pulled from the environment variable `VPC_SUBNET_ID`. Other than the AWS keys needed this is the only environment variable required. -# Available Scenarios -## template -As the name would imply this is a template scenario, no one is supposed to run this and it will not ever work. The purpose is to prevent other scenarios from having to rewrite or copy from one another, this also allows changes to be shared across all scenarios that are descendants of the template. - -## ubuntu-2404 -The ubuntu-2404 scenario is the simplest possible scenario, with a single Ubuntu 24.04 master node and a single Ubuntu 20.04 worker node. - - # To Do - Add tests - Ensure node labels are applied - Ensure setting CIS profile works as expected - - Add scenrios for all supported platforms - - Rocky - - SLES \ No newline at end of file diff --git a/roles/rke2/molecule/rocky-89/molecule.yml b/roles/rke2/molecule/rocky-89/molecule.yml new file mode 100644 index 0000000..31539f3 --- /dev/null +++ b/roles/rke2/molecule/rocky-89/molecule.yml @@ -0,0 +1,60 @@ +--- +driver: + name: ec2 + +platforms: + - name: master-01 + image: ami-02391db2758465a87 + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_servers + - name: worker-01 + image: ami-02391db2758465a87 + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_agents + +provisioner: + name: ansible + playbooks: + converge: ../template/converge.yml + create: ../template/create.yml + destroy: ../template/destroy.yml + requirements: ../template/requirements.yml + inventory: + hosts: + rke2_cluster: + children: + rke2_servers: + vars: + group_rke2_config: + node-label: + - serverGroupLabel=true + hosts: + master-01: + host_rke2_config: + node-label: + - host0Label=true + rke2_agents: + vars: + group_rke2_config: + node-label: + - agentGroupLabel=true + hosts: + worker-01: + host_rke2_config: + node-label: + - host1Label=true + +verifier: + name: ansible \ No newline at end of file diff --git a/roles/rke2/molecule/rocky-94/molecule.yml b/roles/rke2/molecule/rocky-94/molecule.yml new file mode 100644 index 0000000..33c405e --- /dev/null +++ b/roles/rke2/molecule/rocky-94/molecule.yml @@ -0,0 +1,60 @@ +--- +driver: + name: ec2 + +platforms: + - name: master-01 + image: ami-051a0f669bb174783 + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_servers + - name: worker-01 + image: ami-051a0f669bb174783 + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_agents + +provisioner: + name: ansible + playbooks: + converge: ../template/converge.yml + create: ../template/create.yml + destroy: ../template/destroy.yml + requirements: ../template/requirements.yml + inventory: + hosts: + rke2_cluster: + children: + rke2_servers: + vars: + group_rke2_config: + node-label: + - serverGroupLabel=true + hosts: + master-01: + host_rke2_config: + node-label: + - host0Label=true + rke2_agents: + vars: + group_rke2_config: + node-label: + - agentGroupLabel=true + hosts: + worker-01: + host_rke2_config: + node-label: + - host1Label=true + +verifier: + name: ansible \ No newline at end of file diff --git a/roles/rke2/molecule/sles-15/molecule.yml b/roles/rke2/molecule/sles-15/molecule.yml new file mode 100644 index 0000000..d911f3c --- /dev/null +++ b/roles/rke2/molecule/sles-15/molecule.yml @@ -0,0 +1,60 @@ +--- +driver: + name: ec2 + +platforms: + - name: master-01 + image: ami-05e760b0ec1a5588a + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_servers + - name: worker-01 + image: ami-05e760b0ec1a5588a + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_agents + +provisioner: + name: ansible + playbooks: + converge: ../template/converge.yml + create: ../template/create.yml + destroy: ../template/destroy.yml + requirements: ../template/requirements.yml + inventory: + hosts: + rke2_cluster: + children: + rke2_servers: + vars: + group_rke2_config: + node-label: + - serverGroupLabel=true + hosts: + master-01: + host_rke2_config: + node-label: + - host0Label=true + rke2_agents: + vars: + group_rke2_config: + node-label: + - agentGroupLabel=true + hosts: + worker-01: + host_rke2_config: + node-label: + - host1Label=true + +verifier: + name: ansible \ No newline at end of file diff --git a/roles/rke2/molecule/ubuntu-2204/molecule.yml b/roles/rke2/molecule/ubuntu-2204/molecule.yml new file mode 100644 index 0000000..5977f8d --- /dev/null +++ b/roles/rke2/molecule/ubuntu-2204/molecule.yml @@ -0,0 +1,60 @@ +--- +driver: + name: ec2 + +platforms: + - name: master-01 + image: ami-0677b91957321ed76 + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_servers + - name: worker-01 + image: ami-0677b91957321ed76 + instance_type: t2.medium + region: us-east-2 + assign_public_ip: true + tags: + deployed-with: "molecule" + molecule-scenario: "default" + groups: + - rke2_agents + +provisioner: + name: ansible + playbooks: + converge: ../template/converge.yml + create: ../template/create.yml + destroy: ../template/destroy.yml + requirements: ../template/requirements.yml + inventory: + hosts: + rke2_cluster: + children: + rke2_servers: + vars: + group_rke2_config: + node-label: + - serverGroupLabel=true + hosts: + master-01: + host_rke2_config: + node-label: + - host0Label=true + rke2_agents: + vars: + group_rke2_config: + node-label: + - agentGroupLabel=true + hosts: + worker-01: + host_rke2_config: + node-label: + - host1Label=true + +verifier: + name: ansible \ No newline at end of file diff --git a/roles/rke2/molecule/ubuntu-2404/molecule.yml b/roles/rke2/molecule/ubuntu-2404/molecule.yml index 9c34b87..dbdc8b2 100644 --- a/roles/rke2/molecule/ubuntu-2404/molecule.yml +++ b/roles/rke2/molecule/ubuntu-2404/molecule.yml @@ -34,8 +34,6 @@ provisioner: inventory: hosts: rke2_cluster: - vars: - rke2_install_version: v1.27.15+rke2r1 children: rke2_servers: vars: