diff --git a/main.tf b/main.tf index 3c6f055..ea7089c 100644 --- a/main.tf +++ b/main.tf @@ -97,6 +97,13 @@ resource "libvirt_domain" "debian" { cloudinit = libvirt_cloudinit_disk.debian.id + dynamic "local-exec" { + for_each = var.ansible_command != "" ? [1] : [] + content { + command = var.ansible_command + } + } + lifecycle { replace_triggered_by = [ libvirt_cloudinit_disk.debian.id diff --git a/variables.tf b/variables.tf index 3a582a9..e04cdc8 100644 --- a/variables.tf +++ b/variables.tf @@ -64,3 +64,8 @@ variable "fixed_address" { type = string default = "" } + +variable "ansible_command" { + type = string + default = "" +}