From 4e2703c52026009c34e8dcb8294b50881f9152f8 Mon Sep 17 00:00:00 2001 From: clyhtsuriva Date: Mon, 3 Feb 2025 17:21:58 +0100 Subject: opentofu: add kubespray submodule to deploy via ansible Not working yet, getting : "msg": "Ansible must be between 2.16.4 and 2.17.0 exclusive - you have 2.17.5" --- opentofu/k8s-cluster.tf | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'opentofu/k8s-cluster.tf') diff --git a/opentofu/k8s-cluster.tf b/opentofu/k8s-cluster.tf index 1241399..c6392cd 100644 --- a/opentofu/k8s-cluster.tf +++ b/opentofu/k8s-cluster.tf @@ -115,22 +115,11 @@ resource "proxmox_vm_qemu" "k8s_worker" { sshkeys = var.ssh_public_key } - -## Run Ansible playbook after VM creation -#resource "null_resource" "ansible_provisioner" { -# triggers = { -# vm_id = proxmox_vm_qemu.k8s-[worker][cp]-[count.index].id -# } -# -# provisioner "local-exec" { -# command = <<-EOT -# ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_CONFIG=${path.root}/../ansible/ansible.cfg ansible-playbook \ -# -i '${proxmox_vm_qemu.k8s-[worker][cp]-[count.index].default_ipv4_address},' \ -# -u ${var.vm_username} \ -# --private-key ${var.ssh_private_key_path} \ -# ${var.ansible_playbook_path} -# EOT -# } -# -# depends_on = [proxmox_vm_qemu.docker_server] -#} +# Provision the control plane node and the workers +module "ansible_provision_k8s" { + source = "./modules/ansible_provisioner" + inventory_file_path = local_file.ansible_inventory.filename # Pass inventory path here + vm_username = var.vm_username + ssh_private_key_path = var.ssh_private_key_path + ansible_playbook_path = var.k8s_ansible_playbook_path +} -- cgit v1.2.3