Hi all, we need a help,


we have problem to set and get IP Address when we created virtual machine when we use terraform.


step by step: what we created


1) we created virtual machine Debian 9

- installed the software ovirt-guest-agent) [systemctl status ovirt-guest agent = OK

- we created private and public key to connectivity from another computer by .ssh ) /Jenkins Slave/


2) we created template from virtual machine Debian 9

- set this parameter in template initial Run > user, set static IP in Ovirt Managemet


3) downloaded project from GitHub - create virtual machine from template

- terraform main file = OK ?

- terraform init = OK

- terraform apply = OK

: yes

create new virtual machine = OK

start automatically virtual machine = OK

- when I check IP Address > IP address not set

- when I check settings in Ovirt management > network > NOT SET

- virtual machine not has IP addres > not working

- when I change settings in Ovirt management in template Debian from Static IP dhcp > to DHCP

- when I check settings in Ovirt management > network >

IP in Ovit have DHCP, Virtual machine have dhcp OK


But wee need set static IP to Virtual machine and get this IP from terraform.

Thank you all.

Best regard Michal


--- This is the file main.tf:

provider "ovirt" {

url = "${var.ovirt_url}"

username = "${var.ovirt_username}"

password = "${var.ovirt_password}"

}


terraform {

backend "local" {

path = "terraform.tfstate"

}

}


# Create VM call temp02

module "temp01-pipeline" {

source = "../modules/vms"

vm_authorized_ssh_key = "${file(pathexpand("c:/cygwin64/home/Administrator/.ssh/id_rsa.pub"))}"

vm_custom_script = " ${file(pathexpand("c:/Jenkins/workspace/AT_PipelineVM/config/basic/terraform/ovirt/init_script.yml"))}"

cluster_id = "aa583cf2-a07a-11e8-aa92-525400491e5b"

vm_name = "cd-pipeline-1.0.0"

vm_memory = "4096"

vm_cpu_cores = "1"

vm_template_id = "876a260b-26c7-482e-bc19-19b10b9c48bb"



vm_hostname = "temp01.example.com"

vm_user_name = "root"

vm_dns_servers = "8.8.8.8"

vm_dns_search = "example.com"

vm_timezone = "Africa/Nairobi"

vm_nic_device = "env3"

vm_nic_ip_address = "192.168.26.36"

vm_nic_gateway = "192.168.26.2"

vm_nic_netmask = "255.255.255.0"

}