From d40da1a9e82af04ef1ec7cba980ed4ea5c25197d Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sun, 9 Apr 2023 10:46:17 +0200 Subject: [PATCH] add ansible provisioner --- main.tf | 7 +++++++ variables.tf | 5 +++++ 2 files changed, 12 insertions(+) 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 = "" +}