diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index f653a46..f84e018 --- a/README.md +++ b/README.md @@ -76,33 +76,10 @@ Before you begin, ensure you have the following prerequisites installed and conf The Terraform configuration will automatically trigger the Ansible playbook install_containerlab.yml after the EC2 instance is up. This playbook configures the instance with the necessary packages and settings, installs ContainerLab, and optionally clones the specified GitHub repository. -## Network Images Folder and Naming Convention - -### Network Images Folder +## Network Images Folder The `network_images` folder is intended for Docker images that will be used by ContainerLab. These images should be pre-downloaded and placed in this folder before running the Ansible playbook. During the setup process, the images will be copied to the remote `/tmp` directory of the ContainerLab host and then imported into Docker. -### Naming Convention for Images - -It's important to follow a specific naming convention for the images to ensure they are correctly imported into Docker. The naming convention is as follows: - -`system_name_without_digit-*-tag.tar.xz` - -- `system_name_without_digit`: This part of the filename should include the system name without any digits and need to be written in lower case. The system name will be converted to lowercase during the import process. -- `*`: This is a wildcard segment that can include any characters but should not contain the version or tag information. -- `tag`: This part should specify the version or tag of the image. The tag can include both lowercase and uppercase characters and digits. - -#### Example - -Given an image file named `cEOS64-lab-4.30.3M.tar.xz`: - -- `cEOS64` will be the system name. Digits will be removed `ceos`. -- `4.30.3M` will be the tag, kept as-is. - -The image will be imported into Docker with the tag `ceos:4.30.3M`. - -Please ensure that all image files in the `network_images` folder conform to this naming convention for the automated process to function correctly. - ## Accessing ContainerLab - You can access the ContainerLab instance via SSH using the public IP or the DNS name provided by Route53. diff --git a/ansible/install_containerlab.yml b/ansible/install_containerlab.yml old mode 100644 new mode 100755 index b31e11c..729e3ad --- a/ansible/install_containerlab.yml +++ b/ansible/install_containerlab.yml @@ -92,10 +92,4 @@ dest: "/tmp/{{ item | basename }}" with_fileglob: - "../network_images/*" - when: inventory_hostname in groups['all'] - - - name: Import network image to Docker with specific tag - command: - cmd: "docker import /tmp/{{ item | basename }} {{ (item | basename | regex_replace('^(\\D+)-.*-(.*)\\.tar\\.xz', '\\1')) | lower }}:{{ item | basename | regex_replace('^(\\D+)-.*-(.*)\\.tar\\.xz', '\\2') }}" - loop: "{{ query('fileglob', '../network_images/*.tar.xz') }}" when: inventory_hostname in groups['all'] \ No newline at end of file diff --git a/network_images/network-images.md b/network_images/network-images.md old mode 100644 new mode 100755 index dc30a77..1fc038a --- a/network_images/network-images.md +++ b/network_images/network-images.md @@ -1,29 +1,4 @@ # Network images -## Network Images Folder - -The `network_images` folder is intended for Docker images that will be used by ContainerLab. These images should be pre-downloaded and placed in this folder before running the Ansible playbook. During the setup process, the images will be copied to the remote `/tmp` directory of the ContainerLab host and then imported into Docker. - -## Naming Convention for Images - -It's important to follow a specific naming convention for the images to ensure they are correctly imported into Docker. The naming convention is as follows: - -`system_name_without_digit-*-tag.tar.xz` - -- `system_name_without_digit`: This part of the filename should include the system name without any digits and need to be written in lower case. The system name will be converted to lowercase during the import process. -- `*`: This is a wildcard segment that can include any characters but should not contain the version or tag information. -- `tag`: This part should specify the version or tag of the image. The tag can include both lowercase and uppercase characters and digits. - -### Example - -Given an image file named `cEOS64-lab-4.30.3M.tar.xz`: - -- `cEOS64` will be the system name. Digits will be removed `ceos`. -- `4.30.3M` will be the tag, kept as-is. - -The image will be imported into Docker with the tag `ceos:4.30.3M`. - -Please ensure that all image files in the `network_images` folder conform to this naming convention for the automated process to function correctly. - Arista cEOS image can be downlaoded at : arista.com `ceos-lab-4.30.3M.tar.xz` diff --git a/terraform/ec2.tf b/terraform/ec2.tf old mode 100644 new mode 100755 index faf74ce..444a7f2 --- a/terraform/ec2.tf +++ b/terraform/ec2.tf @@ -30,7 +30,7 @@ resource "aws_security_group" "netlab_sg" { resource "aws_instance" "containerlab_host" { ami = var.AWS_AMI[var.AWS_REGION] - instance_type = "t2.xlarge" + instance_type = var.INSTANCE_TYPE key_name = var.AWS_KEY_NAME vpc_security_group_ids = [aws_security_group.netlab_sg.id] diff --git a/terraform/outputs.tf b/terraform/outputs.tf old mode 100644 new mode 100755 diff --git a/terraform/route53-record.tf b/terraform/route53-record.tf old mode 100644 new mode 100755 diff --git a/terraform/terraform.tfvars.sample b/terraform/terraform.tfvars.sample old mode 100644 new mode 100755 index 82c6970..4e1cfdc --- a/terraform/terraform.tfvars.sample +++ b/terraform/terraform.tfvars.sample @@ -1,2 +1,5 @@ -AWS_ACCESS_KEY="YOURACCESSKEY" -AWS_SECRET_KEY="YOURACCESSTOKEN" \ No newline at end of file +AWS_ACCESS_KEY = "YOURACCESSKEY" +AWS_SECRET_KEY = "YOURACCESSTOKEN" +AWS_KEY_NAME = "AWS_key_name" +AWS_KEY_LOCATION = "~/.ssh/aws_key.pem" +AWS_R53_ZONE_ID = "R53_ZONE_ID" \ No newline at end of file diff --git a/terraform/variables.tf b/terraform/variables.tf old mode 100644 new mode 100755 index 0e15deb..b2e2441 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -26,7 +26,7 @@ variable "AWS_AMI" { } } -variable "instance_type" { +variable "INSTANCE_TYPE" { type = string default = "t2.xlarge" } \ No newline at end of file