diff options
author | clyhtsuriva <aimeric@adjutor.xyz> | 2025-02-03 17:21:58 +0100 |
---|---|---|
committer | clyhtsuriva <aimeric@adjutor.xyz> | 2025-02-03 17:21:58 +0100 |
commit | 4e2703c52026009c34e8dcb8294b50881f9152f8 (patch) | |
tree | c125c5405bfadb2eb802b2b3c12486274815b293 /opentofu/k8s-cluster.tf | |
parent | 6135497b6b4837cb8bd65bc093b48ef6a14fbf7d (diff) |
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"
Diffstat (limited to 'opentofu/k8s-cluster.tf')
-rw-r--r-- | opentofu/k8s-cluster.tf | 27 |
1 files changed, 8 insertions, 19 deletions
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 +} |