Library contains functions that handle SDAF inventory file.
SDAF inventory yaml file example: QES_DB: hosts: dbhost01: ansible_host : 192.168.1.2 ansible_user : someuser ansible_connection : ssh connection_type : key virtual_host : virtualhostname01 become_user : root os_type : linux vm_name : somevmname01 dbhost02: ansible_host : 192.168.1.3 ansible_user : someuser ansible_connection : ssh connection_type : key virtual_host : virtualhostname02 become_user : root os_type : linux vm_name : somevmname02 vars: node_tier : hana supported_tiers : [hana, scs, pas] QES_SCS: hosts: vars: node_tier : scs supported_tiers : [scs, pas] QES_ERS: hosts: vars: node_tier : ers supported_tiers : [ers]
read_inventory_file($sap_inventory_file_path);
Returns SDAF inventory file content in perl HASHREF format.
inventory_file_path Full file path pointing to SDAF inventory file
ssh_config_entry_add(entry_name=>'jump_host', hostname=>'SuperMario'
[, identity_file=>'/path/to/private/key',
identities_only=>1,
user=>'luigi'
proxy_jump=>'192.168.1.100',
strict_host_key_checking=>0,
batch_mode=>1]);
Produce ~/.ssh/config host entry like:
----- Host Mario_host HostName 192.2.150.85 some_hostname IdentitiesOnly yes BatchMode yes User mario_plumber IdentityFile ~/.ssh/id_rsa -----
entry_name Config entry name. This name can be used instead of host/IP in ssh command. Example: ssh root@<entry_name>
user Define ssh username
hostname Target hostname or IP addr
identity_file Full path to SSH private key
identities_only If true, SSH will only attempt passwordless login
batch_mode If true, all SSH interactive features will be disabled. Test won't have to wait for timeouts.
proxy_jump Jump host hostname, IP addr or point to another entry in config file
strict_host_key_checking Turn off host key check
prepare_ssh_config(inventory_data=>HASHREF, jump_host=>10.10.10.10, jump_host_user=>'azureadm');
Reads referenced SDAF inventory data and composes ~/.ssh/config entry for each host. In case of SDAF you need to specify jump_host if you want to set this up on worker VM and access SUT via SSH proxy. For an example of an SDAF inventory data structure check SYNOPSIS part of this module.
inventory_data SDAF inventory content in referenced perl data structure.
jump_host_ip hostname, IP address or ~/.ssh/config entry pointing to jumphost. Keyless SSH must be working.
jump_host_user SSH login user.
verify_ssh_proxy_connection(inventory_data=>HASHREF);
Reads parsed and referenced SDAF inventory data and executes simple hostname
command on each SUT to verify the connection is working. A check is performed if hostname
output is the same as target from inventory file. For an example of an SDAF inventory data structure check SYNOPSIS part of this module.
inventory_data SDAF inventory content in referenced perl data structure.