summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjerome <jerome@xlinfo.fr>2025-08-29 11:09:17 +0200
committerjerome <jerome@xlinfo.fr>2025-08-29 11:09:17 +0200
commit65ae07a224af9ccec066ea4f6bed826ee45641f8 (patch)
tree1646184fc2ac2b2ba7965d8d23c7f7b6648d526b
parent95b49edd2145c86211f0b96a5ab3dcbc9c48bd2b (diff)
downloadincus-65ae07a224af9ccec066ea4f6bed826ee45641f8.tar.gz
incus-65ae07a224af9ccec066ea4f6bed826ee45641f8.zip
ansible
-rw-r--r--tofu/ansible/main.tf26
1 files changed, 24 insertions, 2 deletions
diff --git a/tofu/ansible/main.tf b/tofu/ansible/main.tf
index 986775a..d491a93 100644
--- a/tofu/ansible/main.tf
+++ b/tofu/ansible/main.tf
@@ -12,7 +12,7 @@ provider "incus" {
}
resource "incus_instance" "debian" {
- name = "webserver1"
+ name = "debian"
project = "lab"
image = "images:debian/12/cloud"
wait_for {
@@ -35,7 +35,7 @@ resource "incus_instance" "debian" {
}
resource "incus_instance" "rocky" {
- name = "webserver2"
+ name = "rocky"
project = "lab"
image = "images:rockylinux/9/cloud"
wait_for {
@@ -57,3 +57,25 @@ resource "incus_instance" "rocky" {
}
}
+resource "incus_instance" "ubuntu" {
+ name = "ubuntu"
+ project = "lab"
+ image = "images:rockylinux/9/cloud"
+ wait_for {
+ type = "ipv4"
+ }
+ provisioner "local-exec" {
+ command = "./local_script ${self.ipv4_address} ${self.name}"
+ }
+ connection {
+ type = "ssh"
+ host = self.ipv4_address
+ user = "ansible"
+ private_key = file("~/.ssh/id_rsa")
+ }
+ provisioner "remote-exec" {
+ inline = [
+ "cloud-init status || true"
+ ]
+ }
+}