def wait_for_ssh(ip_address): print options.YELLOW, "waiting for SSH access", options.WHITE e_code = 1 while e_code != 0: p = subprocess.Popen(["ssh", "-i", options.get_ssh_key() + ".pem", options.get_ssh_user() + "@" + ip_address, "hostname"]) e_code = p.wait() time.sleep(1) print options.GREEN, "SSH access obtained", options.GREEN
def wait_for_ssh(ip_address): print options.YELLOW, "waiting for SSH access", options.WHITE e_code = 1 while e_code != 0: p = subprocess.Popen([ "ssh", "-i", options.get_ssh_key() + ".pem", options.get_ssh_user() + "@" + ip_address, "hostname" ]) e_code = p.wait() time.sleep(1) print options.GREEN, "SSH access obtained", options.GREEN
def configure_instance(ip_address): setup_ansible_hosts(ip_address) print options.YELLOW, "configuring instance:", ip_address, options.WHITE proc = subprocess.Popen([ 'ansible-playbook', '--private-key', options.get_ssh_key() + ".pem", '-u', options.get_ssh_user(), '-i', 'sample.hosts', 'apache2.yml' ], stdout=subprocess.PIPE) exit_code = proc.wait() if exit_code == 0: print options.GREEN, "successfully configured the instance at:", options.WHITE, ip_address else: print options.RED, "failed to configure the instance at:", options.WHITE, ip_address
def configure_instance(ip_address): setup_ansible_hosts(ip_address) print options.YELLOW, "configuring instance:", ip_address, options.WHITE proc = subprocess.Popen(['ansible-playbook', '--private-key', options.get_ssh_key() + ".pem", '-u', options.get_ssh_user(), '-i', 'sample.hosts', 'apache2.yml'], stdout=subprocess.PIPE) exit_code = proc.wait() if exit_code == 0: print options.GREEN, "successfully configured the instance at:", options.WHITE, ip_address else: print options.RED, "failed to configure the instance at:", options.WHITE, ip_address