Подключить дополнительные IP из списка

#!/usr/bin/env python2
# -*- coding: UTF-8 -*-

import sys
import os

n=0
with open('ip.list', 'r') as f:
    for ip in f:
        ip = ip.replace("\n", "")
        if len(ip) > 0:
            with open('/etc/sysconfig/network-scripts/ifcfg-eth0:' + str(n), 'wb') as f:
                text = "\n".join(["DEVICE=eth0:" + str(n),
                    "BOOTPROTO=static",
                    "IPADDR=" + ip,
                    "NETMASK=255.255.255.0"
                    "ONBOOT=yes"])
                f.write(text)
            n += 1

Генератор пароля

#!/usr/bin/env python2
# -*- coding: UTF-8 -*-

import random

def pwgen(length=15):
    """
    Генератор пароля
    """
    keylist='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    password=[]

    while len(password) < length:
        a_char = random.choice(keylist)
        password.append(a_char)
    return ''.join(password)

print pwgen()