v8.0.2: Exclude localhost from SSH configuration

Updated the logic to skip setting SSH configuration for localhost. This change ensures that SSH settings are only applied to remote servers, preventing potential conflicts or unnecessary configurations for the local machine. Additionally, simplified the SSH key name without including the group name in the UI for better clarity.
pull/399/head
Aidaho 2024-09-16 16:08:53 +03:00
parent 85d745f7dd
commit 94e7a23383
2 changed files with 15 additions and 15 deletions

View File

@ -225,6 +225,7 @@ def run_ansible(inv: dict, server_ips: list, ansible_role: str) -> dict:
raise Exception(f'{e}')
for server_ip in server_ips:
if server_ip != 'localhost':
ssh_settings = return_ssh_keys_path(server_ip)
if ssh_settings['enabled']:
inv['server']['hosts'][server_ip]['ansible_ssh_private_key_file'] = ssh_settings['key']

View File

@ -88,11 +88,10 @@ function addCreds(dialog_id) {
if (data.status === 'failed') {
toastr.error(data.error);
} else {
let group_name = getGroupNameById($('#new-sshgroup').val());
let id = data.id;
common_ajax_action_after_success(dialog_id, 'ssh-table-' + id, 'ssh_enable_table', data.data);
$('select:regex(id, credentials)').append('<option value=' + id + '>' + ssh_add_div.val() + '</option>').selectmenu("refresh");
$('select:regex(id, ssh-key-name)').append('<option value=' + id + '>' + ssh_add_div.val() + '_' + group_name + '</option>').selectmenu("refresh");
$('select:regex(id, ssh-key-name)').append('<option value=' + id + '>' + ssh_add_div.val() + '</option>').selectmenu("refresh");
$("input[type=submit], button").button();
$("input[type=checkbox]").checkboxradio();
$("select").selectmenu();