Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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