Skip to content

Commit

Permalink
Add supported platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Hanafin authored and Daemonslayer2048 committed Jul 26, 2024
1 parent bd13dc8 commit 0e77adc
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 14 deletions.
47 changes: 35 additions & 12 deletions roles/rke2/molecule/README.md
Original file line number Diff line number Diff line change
@@ -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`)

Expand All @@ -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
60 changes: 60 additions & 0 deletions roles/rke2/molecule/rocky-89/molecule.yml
Original file line number Diff line number Diff line change
@@ -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:

Check failure on line 37 in roles/rke2/molecule/rocky-89/molecule.yml

View workflow job for this annotation

GitHub Actions / Lint for push

37:18 [trailing-spaces] trailing spaces
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

Check failure on line 60 in roles/rke2/molecule/rocky-89/molecule.yml

View workflow job for this annotation

GitHub Actions / Lint for push

60:16 [new-line-at-end-of-file] no new line character at the end of file
60 changes: 60 additions & 0 deletions roles/rke2/molecule/rocky-94/molecule.yml
Original file line number Diff line number Diff line change
@@ -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
60 changes: 60 additions & 0 deletions roles/rke2/molecule/sles-15/molecule.yml
Original file line number Diff line number Diff line change
@@ -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
60 changes: 60 additions & 0 deletions roles/rke2/molecule/ubuntu-2204/molecule.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions roles/rke2/molecule/ubuntu-2404/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ provisioner:
inventory:
hosts:
rke2_cluster:
vars:
rke2_install_version: v1.27.15+rke2r1
children:

Check failure on line 37 in roles/rke2/molecule/ubuntu-2404/molecule.yml

View workflow job for this annotation

GitHub Actions / Lint for push

37:18 [trailing-spaces] trailing spaces
rke2_servers:
vars:
Expand Down

0 comments on commit 0e77adc

Please sign in to comment.