diff --git a/README.md b/README.md index 6043910..aae214a 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,32 @@ +# Tsunami + **Netbox + XO + Terraform + Ansible = The best deployment kit** -How to run:
-cp passwd.auto.tfvars.example passwd.auto.tfvars
-replace all variable to match your infrastructure +## Configuration -edit cloud_network_config.tftpl to replace eth0 (to be changed) +[Install terraform](https://www.terraform.io/downloads) -create a prefix with IP you want to use on netbox
-edit variables.auto.tfvars +replace your variables: +```bash +# copy password template +cp passwd.auto.tfvars.example passwd.auto.tfvars + +# edit with your infra passwords +nano passwd.auto.tfvars + +# set your template vm network interface +nano cloud_network_config.tftpl + +# create a prefix with IP you want to use on netbox, and set your vm variables +nano variables.auto.tfvars +``` You can add your playbook in the folder playbooks/ and use them in variables.auto.tfvars -then +## Run -terraform init
-terraform plan
+```bash +terraform init +terraform plan terraform apply +``` diff --git a/main.tf b/main.tf index 328a26a..bdf4094 100644 --- a/main.tf +++ b/main.tf @@ -31,7 +31,7 @@ data "xenorchestra_template" "template" { } -resource "xenorchestra_vm" "bar" { +resource "xenorchestra_vm" "vm_deployed" { memory_max = var.ram * 1024 * 1024 * 1024 cpus = var.cpu cloud_config = templatefile("cloud_config.tftpl", { @@ -58,10 +58,7 @@ resource "xenorchestra_vm" "bar" { size = var.disk_size * 1024 * 1024 * 1024 } - tags = [ - "Debian", - "Best Distro", - ] + tags = var.vm_tags // Override the default create timeout from 5 mins to 20. timeouts { @@ -72,6 +69,8 @@ resource "xenorchestra_vm" "bar" { # Generate inventory file resource "local_file" "inventory" { + count = var.playbook != "" ? 1 : 0 + filename = "inventory" content = <