def add_new_worker_nodes(self): """ get new worker nodes added to inventory file """ current_inventory_file = input('Enter complete path to existing inventory file: ') file_exists = os.path.exists('{}'.format(current_inventory_file)) if file_exists: with open('{}'.format(current_inventory_file), 'r') as file: self.inventory_dict = yaml.safe_load(file) try: self.inventory_dict['all']['vars']['compute_nodes'] except KeyError: logging.error('Inventory file does not contain worker nodes info') self.inventory_dict['all']['vars']['cluster_install'] = '5+ node' self.inventory_dict['all']['vars']['compute_nodes'] = [] default = 'nvme0n1' worker_install_device = input('specify the compute node device that will be installed\n' 'default [nvme0n1]: ') worker_install_device = set_values(worker_install_device, default) self.inventory_dict['all']['vars']['worker_install_device'] = worker_install_device self.inventory_dict = get_nodes_info(node_type='new_compute_nodes', inventory=self.inventory_dict, add=True, idrac_user=self.id_user, idrac_pass=self.id_pass, nodes_info=self.nodes_inv) self.yaml_inventory(inventory_file=current_inventory_file) sys.exit(2) else: logging.error('incorrect file path specified') sys.exit(2)
def get_worker_nodes(self): """ get details about worker node """ self.inventory_dict['all']['vars']['compute_nodes'] = [] self.inventory_dict['all']['vars']['num_of_compute_nodes'] = len(self.nodes_inv['compute_nodes']) self.inventory_dict = get_nodes_info(node_type='compute_nodes', inventory=self.inventory_dict, idrac_user=self.id_user, idrac_pass=self.id_pass, nodes_info=self.nodes_inv)
def get_master_nodes(self): """ get details about master node """ self.clear_screen() self.inventory_dict['csah']['vars']['control_nodes'] = [] self.inventory_dict['csah']['vars']['num_of_control_nodes'] = len( self.nodes_inv['control_nodes']) self.inventory_dict = get_nodes_info(node_type='control_nodes', inventory=self.inventory_dict, idrac_user=self.id_user, idrac_pass=self.id_pass, nodes_info=self.nodes_inv)