Created
June 5, 2018 21:08
-
-
Save NicTanghe/31f76521ce1166b804a539f40ec21c60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess | |
#will be replaced with inputs from Chef | |
name='test' | |
vcpus=1 | |
memory=2048 | |
iso='/var/lib/libvirt/images/Centos.iso' | |
discsize= 80 | |
os_type='linux' | |
os_variant='centos7' | |
network_bridge='default' | |
#setting up the command | |
args = ( | |
'virt-install' + | |
' --name=' + name + | |
' --vcpus=' + vcpus + | |
' --memory=' + memory + | |
' --cdrom=' + iso + | |
' --disk size=' + discsize + | |
' --os-type=' + os_type + | |
' --os-varient=' + os_variant + | |
' --network bridge=' + network_bridge + | |
" --extra-args 'console=ttyS0,115200n8 serial'" | |
) | |
#execute the commands in bash | |
subprocess.call(args, shell=True) | |
#reminder | |
# virt-install\ | |
# --name=name \ | |
# --vcpus=vcpus \ | |
# --memory=memory \ | |
# --cdrom=iso \ | |
# --disk size=discsize \ | |
# --os-type=os_type | |
# --os-variant=os_variant\ | |
# --network bridge=network_bridge \ | |
# --extra-args 'console=ttyS0,115200n8 serial' | |
# ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment