lib/sles4sap/sap_deployment_automation_framework/inventory_tools.pm

SYNOPSIS

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

read_inventory_file($sap_inventory_file_path);

Returns SDAF inventory file content in perl HASHREF format.

ssh_config_entry_add

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 -----

prepare_ssh_config

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.

verify_ssh_proxy_connection

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.