Add copy from Local Folder feature
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
- git
|
- git
|
||||||
- tree
|
- tree
|
||||||
- htop
|
- htop
|
||||||
|
- rsync
|
||||||
state: latest
|
state: latest
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
@@ -75,6 +76,14 @@
|
|||||||
become: yes
|
become: yes
|
||||||
when: repo_git_url | length > 0
|
when: repo_git_url | length > 0
|
||||||
|
|
||||||
|
- name: Synchronize local directory to VM
|
||||||
|
synchronize:
|
||||||
|
src: "{{ local_dir_path }}"
|
||||||
|
dest: "/opt/containerlab/projet/"
|
||||||
|
recursive: yes
|
||||||
|
become: yes
|
||||||
|
when: local_dir_path | length > 0
|
||||||
|
|
||||||
- name: Copy network images to remote /tmp directory
|
- name: Copy network images to remote /tmp directory
|
||||||
copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ resource "aws_security_group" "netlab_sg" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "containerlab_host" {
|
resource "aws_instance" "containerlab_host" {
|
||||||
ami = var.AWS_AMIS[var.AWS_REGION]
|
ami = var.AWS_AMI[var.AWS_REGION]
|
||||||
instance_type = "t2.xlarge"
|
instance_type = "t2.xlarge"
|
||||||
key_name = var.AWS_KEY_NAME
|
key_name = var.AWS_KEY_NAME
|
||||||
vpc_security_group_ids = [aws_security_group.netlab_sg.id]
|
vpc_security_group_ids = [aws_security_group.netlab_sg.id]
|
||||||
@@ -46,6 +46,11 @@ resource "aws_instance" "containerlab_host" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provisioner "local-exec" {
|
provisioner "local-exec" {
|
||||||
command = "sleep 20; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u admin -i ../ansible/inventory --private-key ${var.AWS_KEY_LOCATION} ../ansible/install_containerlab.yml --extra-vars repo_git_url=${var.GITHUB_REPO_URL}"
|
command = <<EOT
|
||||||
|
sleep 20
|
||||||
|
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u admin -i ../ansible/inventory --private-key ${var.AWS_KEY_LOCATION} ../ansible/install_containerlab.yml \
|
||||||
|
${var.GITHUB_REPO_URL != "" ? "--extra-vars repo_git_url=${var.GITHUB_REPO_URL}" : ""} \
|
||||||
|
${var.LOCAL_DIR_PATH != "" ? "--extra-vars local_dir_path=${var.LOCAL_DIR_PATH}" : ""}
|
||||||
|
EOT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,12 +9,17 @@ variable "GITHUB_REPO_URL" {
|
|||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "LOCAL_DIR_PATH" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
variable "AWS_REGION" {
|
variable "AWS_REGION" {
|
||||||
type = string
|
type = string
|
||||||
default = "eu-west-3"
|
default = "eu-west-3"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "AWS_AMIS" {
|
variable "AWS_AMI" {
|
||||||
type = map(any)
|
type = map(any)
|
||||||
default = {
|
default = {
|
||||||
"eu-west-3" = "ami-087da76081e7685da"
|
"eu-west-3" = "ami-087da76081e7685da"
|
||||||
|
|||||||
Reference in New Issue
Block a user