From dc69cd87d42db671509c415b8e734e30a5b7749f Mon Sep 17 00:00:00 2001 From: djpbessems Date: Tue, 19 Apr 2022 13:27:38 +0200 Subject: [PATCH] Add new VM's to Ansible inventory --- playbook.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/playbook.yml b/playbook.yml index a31ecfe..45e2822 100644 --- a/playbook.yml +++ b/playbook.yml @@ -10,7 +10,7 @@ url: "https://{{ repo_username }}:{{ repo_password }}@{{ image.ova_url }}" dest: /scratch/image.ova - - name: Deploy VMs from OVF-template + - name: Deploy VM's from OVF-template community.vmware.vmware_deploy_ovf: hostname: "{{ hv.hostname }}" username: "{{ hv.username }}" @@ -51,5 +51,9 @@ delay: 100 until: job_poll.finished - - ansible.builtin.debug: - var: job_poll + - name: Register new VM's in inventory + ansible.builtin.add_host: + name: "{{ item.instance.hw_name }}" + ansible_host: "{{ item.item.item.ip | ansible.utils.ipaddr('address') }}" + groups: k3s-ha + with_items: "{{ job_poll | json_query('results[*]') }}"