From a6afac22f5f4e7e80e50f96a0d2c89a088b7ab93 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 11 Mar 2023 18:04:58 +0100 Subject: [PATCH] working ansible --- ansible.yml | 8 ++++++++ cloud_init.cfg.tftpl | 2 -- main.tf | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ansible.yml b/ansible.yml index 1f2a418..58cd217 100644 --- a/ansible.yml +++ b/ansible.yml @@ -1,5 +1,13 @@ +--- - hosts: all + + gather_facts: no tasks: + - name: Wait for system to become reachable + wait_for_connection: + + - name: Gather facts for the first time + setup: - name: ensure file exists copy: content: "" diff --git a/cloud_init.cfg.tftpl b/cloud_init.cfg.tftpl index 1e6f2b1..d67ccbc 100644 --- a/cloud_init.cfg.tftpl +++ b/cloud_init.cfg.tftpl @@ -11,5 +11,3 @@ chpasswd: expire: False packages: - qemu-guest-agent -ansible: - install_method: pip diff --git a/main.tf b/main.tf index e75dd58..dd15196 100644 --- a/main.tf +++ b/main.tf @@ -49,4 +49,8 @@ resource "libvirt_domain" "ubuntu" { } cloudinit = libvirt_cloudinit_disk.cloudinit.id + + provisioner "local-exec" { + command = "ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -T 60 -u root -i '192.168.30.7,' ansible.yml" + } }