my script in python 3.8 must run an external command and use some variables, and is:
print('\nProvisiong VM with ansible')
print(url)
print(vm_id)
output = subprocess.run(["ansible-playbook", "-i", "%s:22%s,", "-e", "ansible_user=ubuntu", "playbook.yml" % (url, vm_id)])
print(output)
I've insert the print(url) and print(vm_id) to see if they exist, the result is:
Provisiong VM with ansible
11.22.33.44
113
Traceback (most recent call last):
File "./launch_vm.py", line 136, in <module>
output = subprocess.run(["ansible-playbook", "-i", "%s:22%s,", "-e", "ansible_user=ubuntu", "playbook.yml" % (url, vm_id)])
TypeError: not all arguments converted during string formatting
The syntax seems correct to me ... maybe the problem is with the subprocess call?
Thanks