lib/sles4sap/sap_deployment_automation_framework/ansible.pm

new

my $playbook_setup = sles4sap::sap_deployment_automation_framework::ansible->new();

Class used for handling list of playbook settings for further execution by sdaf_execute_playbook(). Playbook description is here as well: https://learn.microsoft.com/en-us/azure/sap/automation/run-ansible?tabs=linux

set

my $playbook_setup = sles4sap::sap_deployment_automation_framework::ansible->new();
$playbook_setup->set(@components)

Method Creates list of playbook settings according to @components that are to be installed. Method can be called only once, otherwise it will die. This is to prevent resetting playbook order accidentally. Returns full data structure of settings compiled in ARRAYREF format. Example: [ {playbook_filename => 'playbook_name_A.yaml', timeout => 120}, {playbook_filename => 'playbook_name_B.yaml', timeout => 90} ]

get

my $playbook_setup = sles4sap::sap_deployment_automation_framework::ansible->new();
$playbook_setup->set(@components);
$playbook_setup->get();

Purpose of this method is to serve the caller playbook name and related settings which are to be executed next. Method is supposed to be called in a loop until all playbooks are returned. Once there are no playbooks left, structure with undefined values is returned.

ansible_execute_command

ansible_execute_command(
    command=>'rm -Rf /', host_group=>'QES_SCS', sdaf_config_root_dir=>'/some/path' , sap_sid=>'CAT');

Execute command on host group using ansible. Returns execution output.

sdaf_ansible_verbosity_level

sdaf_ansible_verbosity_level($verbosity_level);

Returns string that is to be used as verbosity parameter -v for 'ansible-playbook' command. This is controlled by positional argument $verbosity_level. Values can specify verbosity level using integer up to 6 (max supported by ansible) or just set to anything equal to 'true' which will default to -vvvv. Value -vvvv should be enough to debug network connection problems according to ansible documentation: https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html#cmdoption-ansible-playbook-v

sdaf_execute_playbook

sdaf_execute_playbook(
    playbook_filename=>'playbook_04_00_01_db_ha.yaml',
    sdaf_config_root_dir=>'/path/to/joy/and/happiness/'
    sap_sid=>'ABC',
    timeout=>'42',
    verbosity_level=>'3'
    );

Execute playbook specified by playbook_filename and record command output in separate log file. Verbosity level of ansible-playbook is controlled by openQA parameter SDAF_ANSIBLE_VERBOSITY_LEVEL. If undefined, it will use standard output without adding any -v flag. See function sdaf_execute_playbook for details.

sdaf_register_byos

sdaf_register_byos(sdaf_config_root_dir=>'/stairway/to_heaven', scc_reg_code=>'CODE-XYZ', sap_sid='PRD');

Performs SCC registration on BYOS image using registercloudguest method.