def run_distribute_file(dist_file): p_file = home_dir + "/" + key_nam + ".pem" s_text = ['root@cds1', 'root@cds2'] d_text = hosts_dns1_name inpu_file = home_dir + dist_file for no in range(2): stext = s_text[no] dtext = d_text[no] rhui_lib.answers_replace(stext, dtext, inpu_file) s_text = ['root@rhua'] d_text = hosts_dns2_name inpu_file = home_dir + dist_file for no in range(1): stext = s_text[no] dtext = d_text[no] rhui_lib.answers_replace(stext, dtext, inpu_file) stext = "cloud_key" dtext = "/root/" + key_nam + ".pem" rhui_lib.answers_replace(stext, dtext, inpu_file) print "\n\nWorking again with RHUA instance to upload the updated", inpu_file, " file" for instance in reservation_rhua.instances: host_auto = instance.dns_name command = 'mkdir -p /root/rhui20' print "\nInstalling various rpms: \n", command rhui_lib.remote_exe(host_auto, p_file, command) l_path = home_dir + dist_file f_path = "/root" + dist_file rhui_lib.putfile(host_auto, p_file, l_path, f_path)
def answers_file(ans_file): s_text = ['rhua.example.com', 'cds1.example.com', 'cds2.example.com'] d_text = hosts_dns_name inpu_file = home_dir + ans_file for no in range(3): stext = s_text[no] dtext = d_text[no] rhui_lib.answers_replace(stext, dtext, inpu_file) s_text = ['rhua.crt', 'cds1.crt', 'cds2.crt'] d_text = ssl_certs for no in range(3): stext = s_text[no] dtext = d_text[no] rhui_lib.answers_replace(stext, dtext, inpu_file) print "\n\nWorking again with RHUA instance to upload the updated answers.sample file" p_file = home_dir + "/" + key_nam + ".pem" for instance in reservation_rhua.instances: host_auto = instance.dns_name l_path = home_dir + ans_file f_path = "/root" + ans_file rhui_lib.putfile(host_auto, p_file, l_path, f_path)
call(["cp", os.path.expanduser("~/rhui20/pulp.conf"), os.path.expanduser("~/rhui20/pulp1")]) call(["cp", os.path.expanduser("~/rhui20/cds.conf"), os.path.expanduser("~/rhui20/cds1")]) call(["cp", os.path.expanduser("~/rhui20/rhui-tools.conf"), os.path.expanduser("~/rhui20/rhui-tools1")]) call(["cp", os.path.expanduser("~/rhui20/answers_file"), os.path.expanduser("~/rhui20/answers_file1")]) call(["cp", os.path.expanduser("~/rhui20/run_distribute.sh"), os.path.expanduser("~/rhui20/run_distribute.sh.bkp")]) call(["cp", os.path.expanduser("~/rhui20/hostname.sh"), os.path.expanduser("~/rhui20/hostname.sh.bkp")]) call(["cp", os.path.expanduser("~/rhui20/host.sh"), os.path.expanduser("~/rhui20/host.sh.bkp")]) for instance1 in reservation_rhua.instances: host_pulp_srv = instance1.private_dns_name stext = "localhost" dtext = host_pulp_srv file_list_file = ['pulp.conf'] for inpu in file_list_file: inpu_file = home_dir + "/rhui20/" + inpu rhui_lib.answers_replace(stext, dtext, inpu_file) stext = "localhost" dtext = host_pulp_srv inpu_file = home_dir + "/rhui20/rhui-tools.conf" rhui_lib.answers_replace(stext, dtext, inpu_file) for instance in reservation_cds.instances: host_pulp_srv = instance1.private_dns_name stext = "localhost.localdomain" dtext = host_pulp_srv file_list_file = ['cds.conf'] for inpu in file_list_file: inpu_file = home_dir + "/rhui20/" + inpu rhui_lib.answers_replace(stext, dtext, inpu_file) os.system("pushd ~/rhui20 > /dev/null ; tar -cvf ~/rhui20/pulp_setup.tar pulp.conf cds.conf rhui-tools.conf ; popd > /dev/null")