diff options
author | mkorobeinikov <92354771+mkorobeinikov@users.noreply.github.com> | 2024-02-28 05:12:59 +0300 |
---|---|---|
committer | mkorobeinikov <92354771+mkorobeinikov@users.noreply.github.com> | 2024-02-28 05:12:59 +0300 |
commit | 7bc958040027f5e6f73d150fbaa79ede97be5a8c (patch) | |
tree | 6d5c8bad4da4f5b6938c2469466e1a31c3eb00e9 /Terraform | |
parent | 538db10a9b388a753a5732b6ffc4e8cbd90a5121 (diff) | |
download | vyos-automation-7bc958040027f5e6f73d150fbaa79ede97be5a8c.tar.gz vyos-automation-7bc958040027f5e6f73d150fbaa79ede97be5a8c.zip |
update
Diffstat (limited to 'Terraform')
8 files changed, 0 insertions, 189 deletions
diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/ansible.cfg b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/ansible.cfg deleted file mode 100644 index 3ea4292..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/ansible.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[defaults] -inventory = /root/aws/ip.txt -host_key_checking= False -private_key_file = /root/aws/mykey.pem -remote_user=vyos -[privilege_escalation] -[inventory] -[paramiko_connection] -[ssh_connection] -[persistent_connection] -[accelerate] -[selinux] -[colors] -[diff] diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/group_vars/all b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/group_vars/all deleted file mode 100644 index 49ff69f..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/group_vars/all +++ /dev/null @@ -1,3 +0,0 @@ -ansible_connection: ansible.netcommon.network_cli -ansible_network_os: vyos.vyos.vyos -ansible_user: vyos diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/instance.yml b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/instance.yml deleted file mode 100644 index b8faa08..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/instance.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: integration of terraform and ansible - hosts: all - gather_facts: 'no' - - tasks: - - name: "Wait 300 seconds, but only start checking after 60 seconds" - wait_for_connection: - delay: 60 - timeout: 300 - - - name: Configure general settings for the vyos hosts group - vyos_config: - lines: - - set system name-server 8.8.8.8 - save: - true diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/mykey.pem b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/mykey.pem deleted file mode 100644 index 2fd39a4..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Ansible/mykey.pem +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- - -Copy your key.pem from AWS - ------END OPENSSH PRIVATE KEY----- diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/README.md b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/README.md deleted file mode 100644 index 0577dfa..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# AWS_terraform_ansible_single_vyos_instance -How to create a single instance and install your configuration using Terraform+Ansible+AWS -Step by step: -# AWS -1.1 Create an account with AWS and get your "access_key", "secret key" - -1.2 Create a key pair and download your .pem key - -1.3 Create a security group for the new VyOS instance -# Terraform -2.1 Create a UNIX or Windows instance - -2.2 Download and install Terraform - -2.3 Create the folder for example ../awsvyos/ - -2.4 Copy all files from my folder /Terraform into your Terraform project (vyos.tf, var.tf) -2.4.1 Please type the information into the strings 22, 35, 36 of file "vyos.tf" - -2.5 Type the commands : - - #cd /your folder - - #terraform init -# Ansible -3.1 Create a UNIX instance - -3.2 Download and install Ansible - -3.3 Create the folder for example /root/aws/ - -3.4 Copy all files from my folder /Ansible into your Ansible project (ansible.cfg, instance.yml, mykey.pem) - -mykey.pem you have to get using step 1.2 -# Start -4.1 Type the commands on your Terrafom instance: - - #cd /your folder - - #terraform plan - - #terraform apply - - #yes - - diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Terraform/var.tf b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Terraform/var.tf deleted file mode 100644 index 6f1e65d..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Terraform/var.tf +++ /dev/null @@ -1,18 +0,0 @@ -variable "password" { - description = "pass for Ansible" - type = string - sensitive = true -} -variable "host"{ - description = "The IP of my Ansible" -} -variable "access" { - description = "my access_key for AWS" - type = string - sensitive = true -} -variable "secret" { - description = "my secret_key for AWS" - type = string - sensitive = true -}
\ No newline at end of file diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Terraform/vyos.tf b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Terraform/vyos.tf deleted file mode 100644 index 8940ab5..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/Terraform/vyos.tf +++ /dev/null @@ -1,87 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 5.0" - } - } -} - -provider "aws" { - access_key = var.access - secret_key = var.secret - region = var.region -} - -variable "region" { - default = "us-east-1" - description = "AWS Region" -} - -variable "ami" { - default = "ami-**************" # ami image please enter your details - description = "Amazon Machine Image ID for VyOS" -} - -variable "type" { - default = "t2.micro" - description = "Size of VM" -} - -# my resource for VyOS - -resource "aws_instance" "myVyOSec2" { - ami = var.ami - key_name = "mykeyname" # Please enter your details - security_groups = ["my_sg"] # Please enter your details - instance_type = var.type - tags = { - name = "VyOS System" - } -} - -output "my_IP"{ -value = aws_instance.myVyOSec2.public_ip -} - - -#IP of aws instance copied to a file ip.txt in local system Terraform - -resource "local_file" "ip" { - content = aws_instance.myVyOSec2.public_ip - filename = "ip.txt" -} - -#connecting to the Ansible control node using SSH connection - -resource "null_resource" "SSHconnection1" { -depends_on = [aws_instance.myVyOSec2] -connection { - type = "ssh" - user = "root" - password = var.password - host = var.host -} -#copying the ip.txt file to the Ansible control node from local system - provisioner "file" { - source = "ip.txt" - destination = "/root/aws/ip.txt" # The folder of your Ansible project - } -} - -resource "null_resource" "SSHconnection2" { -depends_on = [aws_instance.myVyOSec2] -connection { - type = "ssh" - user = "root" - password = var.password - host = var.host -} -#command to run Ansible playbook on remote Linux OS -provisioner "remote-exec" { - inline = [ - "cd /root/aws/", - "ansible-playbook instance.yml" -] -} -} diff --git a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/images/aws.png b/Terraform/AWS_terraform_ansible_single_vyos_instance-main/images/aws.png Binary files differdeleted file mode 100644 index c1c111b..0000000 --- a/Terraform/AWS_terraform_ansible_single_vyos_instance-main/images/aws.png +++ /dev/null |