If i have a text file that contains an x number of lines like:
hostINFO = ['hostTYPE', 'hostOS', 'hostENV', 'hostNAME', 'hostIP', 'dbUNAME', 'dbPWD', 'dbPORT', 'orgNAME', 'nrdsTOKEN']
How would I create a python script that would:
- import a line as a variable list so that i can refer to it as hostINFO[0] or hostINFO[1] etc....
- execute the script against the variables
- when completed go back to the host.txt file and get the next line and continue till no more lined exist.
update....
i changed my hosts.txt file format to be a comma delimited:
hostTYPE,hostOS,hostENV,hostNAME,hostIP,dbUNAME,dbPWD,dbPORT,orgNAME,nrdsTOKEN`
deploy.py
with open("hosts.txt") as f:
for line in f:
hostINFO = line.strip().split(',')