Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Отчет

Задание - развернуть две виртуальные машины с помощью Terraform. С помощью Ansible на одной запустить докер образ приложения todo-list из туториала к докеру, на второй запустить базу данных для этого приложения.

## Использование

```bash
cd preemptible_server
terraform init
terraform apply
cd ../ansible
ansible-playbook playbook.yml
```

## Скриншоты
- openstack provider

![alt text](assets/image.png)

- servers
![alt text](assets/image-1.png)

![alt text](assets/image-2.png)

- networks

![alt text](assets/image-4.png)

![alt text](assets/image-3.png)

![alt text](assets/image-5.png)

- Задание ключа для доступа к ВМ

![alt text](assets/image-6.png)

- Create flavor 1CPU 1 gb RAM, Disk 5gb per vm (basic hdd)

![alt text](assets/image-7.png)

- the output

![alt text](assets/image-9.png)

- `inventory.tmpl`

![alt text](assets/image-10.png)

after running terraform apply:

![alt text](assets/image-8.png)

- an inventory.ini file for ansible, which describes the IP addresses of the created VMs

![alt text](assets/image-11.png)

- playbooks for deploying the application in docker-compose files

![alt text](assets/image-12.png)

![alt text](assets/image-13.png)

## Результат

При переходе по адресу `http://5.188.81.9/` мы попадаем на страницу с приложением todo-list

![alt text](assets/image-14.png)
2 changes: 1 addition & 1 deletion ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ansible_user: root
ansible_ssh_private_key_file: ~/.ssh/id_rsa # you can change path to your private key
ansible_ssh_private_key_file: ~/.ssh/id_ed25519 # you can change path to your private key
4 changes: 4 additions & 0 deletions ansible/inventory.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[webapp]
5.188.81.9 private_database_ip=192.168.0.38
[database]
5.188.80.154
Binary file added assets/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions preemptible_server/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion preemptible_server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module "keypair" {
source = "./modules/keypair"
keypair_name = "keypair-tf"
keypair_public_key = file("~/.ssh/id_rsa.pub")
keypair_public_key = file("~/.ssh/id_ed25519.pub")
region = var.region
}

Expand Down
4 changes: 4 additions & 0 deletions preemptible_server/resources/inventory.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[webapp]
${webapp_vm_ip_public} private_database_ip=${webapp_vm_ip_nat}
[database]
${database_vm_ip_public}
16 changes: 8 additions & 8 deletions preemptible_server/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ terraform {
version = "~> 1.49.0"
}
}
backend "s3" {
bucket = "/students"
endpoint = "s3.storage.selcloud.ru"
key = "thirdtask.tfstate"
region = "ru-1"
skip_region_validation = true
skip_credentials_validation = true
}
# backend "s3" {
# bucket = "/students"
# endpoint = "s3.storage.selcloud.ru"
# key = "thirdtask.tfstate"
# region = "ru-1"
# skip_region_validation = true
# skip_credentials_validation = true
# }
}