Fixing of running.

This commit is contained in:
Emiliano Vavassori 2022-08-17 21:55:14 +02:00
parent 4e089a019b
commit 64b5aafcbd
2 changed files with 5 additions and 5 deletions

View File

@ -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])

View File

@ -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