From 64b5aafcbdc29cf410930430d898bb9022ab682d Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Wed, 17 Aug 2022 21:55:14 +0200 Subject: [PATCH] Fixing of running. --- proxmoxve-ansible-python/__main__.py | 8 ++++---- proxmoxve-ansible-python/ansible.cfg | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxmoxve-ansible-python/__main__.py b/proxmoxve-ansible-python/__main__.py index 85fd6bf..4f74cdd 100644 --- a/proxmoxve-ansible-python/__main__.py +++ b/proxmoxve-ansible-python/__main__.py @@ -93,13 +93,13 @@ vm = proxmox.vm.VirtualMachine("vm", ) ) -# Getting local IP # First item of the ipv4_addresses is of the loopback interface (so the usual 127.0.0.1). Let's get the second and grab only the text. -lanip = vm.ipv4_addresses[1][0] # Creating the inventory file. with open('inventory', 'w') as f: - f.write(f"{vm_name} ansible_host={lanip} ansible_user={vm_username}") + vm.ipv4_addresses[1][0].apply( + lambda lanip: f.write(f"{vm_name} ansible_host={lanip} ansible_user={vm_username}") + ) # Try the deployment with ansible @@ -110,4 +110,4 @@ execute_ansible = command.local.Command("ansible", ) # Outputs -pulumi.export("ip", lanip) +pulumi.export("ip", vm.ipv4_addresses[1][0]) diff --git a/proxmoxve-ansible-python/ansible.cfg b/proxmoxve-ansible-python/ansible.cfg index 1752d61..43406af 100644 --- a/proxmoxve-ansible-python/ansible.cfg +++ b/proxmoxve-ansible-python/ansible.cfg @@ -1,5 +1,5 @@ [defaults] -collections_on_ansible_version_mismatch = False +collections_on_ansible_version_mismatch = ignore action_warnings = False host_key_checking = False inventory = inventory