elif "y" in options.show_sha_sums.lower()[0]: show_sha_sums = True elif "n" in options.show_sha_sums.lower()[0]: show_sha_sums = False else: print("Plesse enter yes/no or y/n to display/hide sha sums") parser.print_help() sys.exit() ansible_host_list = process_host_file(options.ansible_host_file) for server in ansible_host_list: print("\n") can_connect_to_server = test_ssh_keys(server, ansible_ssh_user) # if we can connect to remote host, go ahead and run the verification checks if can_connect_to_server: ssh_connection.open_ssh(server, ansible_ssh_user) check_docker_files(server, ssh_connection, docker_files_have_been_modified_dict, default_docker_hashes, remote_docker_file_sums_dict) print(textColors.HEADER + "Checking to see if /var/lib/etcd is a partition..." + textColors.ENDC) etcd_partition_output = HandleSSHConnections.run_remote_commands(ssh_connection, '/usr/bin/python -c \"import os; print os.path.ismount(\'/var/lib/etcd\')\"') parse_etcd(server, etcd_partition_output, etcd_partition_dict) print(textColors.HEADER + "Running 'yum list installed' on %s..." % server + textColors.ENDC) installed_package_query(server, repo_dict, ose_required_packages_list, ssh_connection) print(textColors.HEADER + "Running 'yum list updates' on %s..." % server + textColors.ENDC) update_required_query(server, package_updates_available_dict, ose_required_packages_list, ssh_connection) print(textColors.HEADER + "Running 'sestatus' on %s" % server + textColors.ENDC) is_selinux_enabled(server, ssh_connection, selinux_dict) print(textColors.HEADER + "Running 'systemctl status docker' on %s..." % server + textColors.ENDC) systemctl_output = HandleSSHConnections.run_remote_commands(ssh_connection, "systemctl status docker") is_docker_enabled(server, systemctl_output, docker_service_check_dict)
show_sha_sums = False elif "y" in options.show_sha_sums.lower()[0]: show_sha_sums = True elif "n" in options.show_sha_sums.lower()[0]: show_sha_sums = False else: print("Plesse enter yes/no or y/n to display/hide sha sums") parser.print_help() sys.exit() ansible_host_list = process_host_file(options.ansible_host_file) for server in ansible_host_list: can_connect_to_server = test_ssh_keys(server, ansible_ssh_user) # if we can connect to remote host, go ahead and run the verification checks if can_connect_to_server: ssh_connection.open_ssh(server, ansible_ssh_user) check_docker_files(server, ssh_connection, docker_files_have_been_modified_dict, original_docker_file_hashes, remote_docker_file_sums_dict) installed_package_query(server, repo_dict, ose_required_packages_list, ssh_connection) update_required_query(server, package_updates_available_dict, ose_required_packages_list, ssh_connection) is_selinux_enabled(server, ssh_connection, selinux_dict) systemctl_output = HandleSSHConnections.run_remote_commands(ssh_connection, "systemctl status docker") is_docker_enabled(server, systemctl_output, docker_service_check_dict) is_docker_running(server, systemctl_output, docker_service_check_dict) sub_status = HandleSSHConnections.run_remote_commands(ssh_connection, "subscription-manager status") is_host_subscribed(server, subscription_dict, sub_status) repo_information = HandleSSHConnections.run_remote_commands(ssh_connection, "subscription-manager repos") which_repos_are_enabled(server, repo_dict, repo_information, ose_repos) ssh_connection.close_ssh() check_forward_dns_lookup(server, forward_lookup_dict) check_reverse_dns_lookup(forward_lookup_dict, reverse_lookup_dict)
warfile_list = sorted_servers_names_to_deploy_to[server_counter][1] if not warfile_list: print("Could not find any warfiles to deploy. Check: " + deployment_parameters[configuration_counter].warfile_path) continue else: continue_with_deploy = True if skip_nagios == False: if "yes" in nagios_put_in_downtime.lower(): print("\nAttempting to put %s in downtime on nagios server: %s" % (server_name, nagios_server)) DownTimeHandler.put_host_in_downtime(username=nagios_user, password=nagios_password, nagios_server=nagios_server, hostname=server_name.split(".")[0], minutes_in_downtime=nagios_downtime_duration) # Put in a delay to allow nagios time to properly register the down time time.sleep(8) ssh_connection = HandleSSHConnections() ssh_connection.open_ssh(server_name, deployment_parameters[configuration_counter].ssh_user) for individual_warfile in warfile_list: manifest_found = False curl = CurlWarfile(server_name, individual_warfile, tomcat_user=deployment_parameters[configuration_counter].tomcatuser, tomcat_password=deployment_parameters[configuration_counter].tomcatpass, tomcat_port=deployment_parameters[configuration_counter].tomcat_port, tomcat_version=deployment_parameters[configuration_counter].tomcat_version) remote_warfile = deployment_parameters[configuration_counter].tomcat_directory + os.sep + "webapps" + os.sep + \ individual_warfile.split("/")[-1] # skip_server is set to true if there is a problem curling warfiles to a given server if curl.skip_server: break else: if configuration_counter in already_deployed_warfiles: already_deployed_warfiles[configuration_counter].append(individual_warfile)