diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a7910c..e1d7adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,25 @@ # Changelog for SAS Viya ARK +## Viya35-ark-1.1 - December 19, 2019 + +- **Summary**: + Enhancements and fixes related to Upgrade, Deployment Report, Pre-Installation playbooks and documentation. +- Issues addressed: + - General + - VIYAARK-64 - Known Issues section added to main README + - SAS Viya Upgrade Tasks Playbooks + - VIYAARK-45 - DEFAULT_BACKUP_SCHEDULE job not recreated after upgrade from SAS Viya 3.3 to SAS Viya 3.4/3.5 + - VIYAARK-41 - Pre-Upgrade playbook fails if SAS Viya 3.5 software order adds [ModelServer] + - SAS Viya Deployment Report + - VIYAARK-46 - Temporarily disable hotfix report for earlier release + - SAS Viya Pre-Installation Playbook + - VIYAARK-43 - Remove libXp.i686 from required software packages + - VIYAARK-25 - Non-supported Java version check done in normal mode as well as check mode + - VIYAARK-50 - Kernel semaphore performance configuration task not adjusting settings as expected (Python 2) and failing playbook (Python 3) + + + ## Viya35-ark-1.0 - November 19, 2019 - **Summary**: @@ -34,8 +53,6 @@ - DEPENBDAT-627 - Ansible 2.9 support for viya-upgrade related playbook. - Ansible Support: Ansible 2.7.2 - Ansible 2.9 - - ## Viya34-ark-1.7 - August 22, 2019 - **Summary**: diff --git a/README.md b/README.md index 853c3d6..e771386 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,11 @@ Tool support for the latest release of SAS Viya: Related Tools Not Contained in SAS Viya ARK: * SAS Viya ARK only supports Linux. For Windows supporting tools, go to [SAS Viya Deployment Assistant for Windows](https://support.sas.com/en/documentation/install-center/viya/deployment-tools/34/deployment-assistant-windows.html). +## Known Support Issues +The following issues are known and may impact the expected usage or performance of the Viya ARK tools. + +* SAS Viya 3.5 supports Linux on Power on a limited availability basis. The SAS Viya ARK tools do not support Linux on Power in the Viya35-ark-1.0 release. + ## License This project is licensed under the [Apache 2.0 License](LICENSE). \ No newline at end of file diff --git a/playbooks/deployment-report/README.md b/playbooks/deployment-report/README.md index a463421..7cf0a19 100644 --- a/playbooks/deployment-report/README.md +++ b/playbooks/deployment-report/README.md @@ -2,15 +2,8 @@ ## Introduction This playbook gathers information about SAS Viya software and the hosts where it is deployed. -Furthermore, it optionally compares the packages installed on the system with the most up to -date versions to determine which hotfixes have not been applied. The data gathered is then -written to disk as a YAML-formatted data file and a static web-page for easily viewing the data. - -Hotfix information in the report include: -* The hotfixes not applied -* The release date of each hotfix -* Each package and version associated with the hotfix -* The number and title of each SASNote associated with the hotfix +The data gathered is then written to disk as a YAML-formatted data file and a static web-page +for easily viewing the data. Deployment attributes in the report include: * Operating system information and architecture @@ -32,7 +25,6 @@ The output files written to the `sas_viya_playbook/` are: * Install SAS Viya software using the SAS-provided `sas_viya_playbook`. * Obtain a local copy of the inventory file used when deploying the SAS Viya software. * Verify that the user has sudoers privileges. -* Connectivity to sas.com (for the Hotfix Report Only) ## Running the Playbook To run the playbook, execute the following command: @@ -59,20 +51,7 @@ To exclude the static web page and only create the report data: ansible-playbook viya-ark/playbooks/deployment-report/viya-deployment-report.yml -e "exclude_html=true" ``` -To exclude the hotfix report: - ```bash - ansible-playbook viya-ark/playbooks/deployment-report/viya-deployment-report.yml -e "include_hotfix_report=False" - ``` - To force the creation of the report files into the current directory: ```bash ansible-playbook viya-ark/playbooks/deployment-report/viya-deployment-report.yml -e 'output_dir=./' ``` -To specify an alternate location for the published hotfix data: - ```bash - ansible-playbook viya-ark/playbooks/deployment-report/viya-deployment-report.yml -e 'hotfix_url=' - ``` -To specify an alternate hotfix file: - ```bash - ansible-playbook viya-ark/playbooks/deployment-report/viya-deployment-report.yml -e 'hotfix__master_file=' - ``` diff --git a/playbooks/deployment-report/library/process_sas_host_details.py b/playbooks/deployment-report/library/process_sas_host_details.py index 8cac782..25a61a7 100644 --- a/playbooks/deployment-report/library/process_sas_host_details.py +++ b/playbooks/deployment-report/library/process_sas_host_details.py @@ -41,22 +41,24 @@ description: - The name of the dict object registered with hostvars which will contain the host details. required: true - include_hotfix_report: - description: - - Whether or not to include the hotfix report. - required: false - default: true - hotfix_url: - description: - - The URL to look for the published hotfixes. - require: False - default: http://ftp.sas.com/techsup/download/hotfix/HF2/util01/Viya/data/ - hotfix_master_file: - description: - - The file that holds all of the hotfix infomration. - require: False - default: Viya_Update_Page_Index.xml ''' +# The following are options for the hotfix report, which has been temporarily disabled for this release. +# include_hotfix_report: +# description: +# - Whether or not to include the hotfix report. +# required: false +# default: true +# hotfix_url: +# description: +# - The URL to look for the published hotfixes. +# require: False +# default: http://ftp.sas.com/techsup/download/hotfix/HF2/util01/Viya/data/ +# hotfix_master_file: +# description: +# - The file that holds all of the hotfix infomration. +# require: False +# default: Viya_Update_Page_Index.xml +#''' EXAMPLES = ''' # Process SAS deployment information diff --git a/playbooks/deployment-report/viya-deployment-report.yml b/playbooks/deployment-report/viya-deployment-report.yml index 23b601c..97e82e0 100644 --- a/playbooks/deployment-report/viya-deployment-report.yml +++ b/playbooks/deployment-report/viya-deployment-report.yml @@ -30,7 +30,8 @@ report_file_name: "viya_deployment_report" report_data_file_name: "{{ report_file_name + '_data' }}" output_dir: "{{ playbook_dir + '/../../..' }}" - include_hotfix_report: True + # The hotfix report has been temporarily disabled this release. + include_hotfix_report: False hotfix_url: "http://ftp.sas.com/techsup/download/hotfix/HF2/util01/Viya/data/" hotfix_master_file: "Viya_Update_Page_Index.xml" diff --git a/playbooks/pre-install-playbook/README.md b/playbooks/pre-install-playbook/README.md index 7e9622a..29fff11 100644 --- a/playbooks/pre-install-playbook/README.md +++ b/playbooks/pre-install-playbook/README.md @@ -65,9 +65,7 @@ You can elicit the SAS Viya 3.4 behavior by passing in extra parameter ```-e viy ### Supported Java Runtime Environment (JRE) Versions Due to some compatibility issues with some components of SAS Viya 3.5, a minimum version of Java is now required. That minimum version can be found by examining the ```min_java_version``` variable in roles/viya-ark.preinstall/defaults/main.yml. -The tasks controlled by the ```required_packages_config``` tag will have different behavior in SAS Viya 3.5. If there is a previously installed Java and that version is less than the minimum version required for SAS Viya 3.5, the playbook will fail if executed with ```--check```. If it is executed in normal mode, the playbook will behave as it did with SAS Viya 3.4 and, if no Java is installed, the latest Java will be installed. The "latest" Java is determined by the value of ```java_openjdk_version``` found in roles/viya-ark.preinstall/vars/default.yml (or OS-specific var files in that same directory). The actual version of Java that is installed is therefore dependent on what version is available in the repositories set up for the environment. -If Java is already installed, and the playbook is executed in normal mode, no update to the Java package will occur. The version found to be installed will be reflected in a debug message for awareness sake. It is recommended to execute ```--check``` mode in order to validate any previously installed Java version with respect -to the SAS Viya 3.5 minimum supported Java version requirement. +The tasks controlled by the ```required_packages_config``` tag will have different behavior in SAS Viya 3.5. If there is a previously installed Java and that version is less than the minimum version required for SAS Viya 3.5, the playbook will fail and report the version mismatch. If no Java is installed, the latest available Java will be installed and the minimum version check tasks will be executed. The "latest" Java is determined by the value of ```java_openjdk_version``` found in roles/viya-ark.preinstall/vars/(OS-specific).yml. The actual version of Java that is installed is therefore dependent on what version is available in the repositories set up for the environment. ### Required package version for RHEL deployments Starting with SAS Viya 3.5, minimum versions of certain packages are now required for standard RHEL deployments; please note that this does NOT apply to deployments on Oracle RHEL. The required packages and minimum versions can be found by examining the ```required_package_versions_rhel``` variable in roles/viya-ark.preinstall/defaults/main.yml. These packages must either be already installed at the minimum version specified, or available in a registered repository at deployment time. The pre-install playbook will fail execution if neither of these conditions are met. diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/defaults/main.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/defaults/main.yml index 4a3977b..8fd7e1f 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/defaults/main.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/defaults/main.yml @@ -7,8 +7,6 @@ os_major_version_1: 7 os_major_minor_version_1: 7.1 os_major_version_2: 6 os_major_minor_version_2: 6.7 -os_major_version_3: 8 -os_major_minor_version_3: 8.0 suse_os_major_version: 12 suse_os_major_minor_version: 12.2 @@ -135,7 +133,6 @@ packages_general: - "{{ java_openjdk_version }}" - numactl - "{{ libXp_x86_64_pkg }}" - - "{{ libXp_i686_pkg }}" - "{{ libXext_pkg }}" - "{{ libXmu_pkg }}" - "{{ libXtst_pkg }}" diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.os_version_check.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.os_version_check.yml index 9d05e3b..bd00397 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.os_version_check.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.os_version_check.yml @@ -18,7 +18,7 @@ - ansible_os_family == redhat_os_name or ansible_os_family == suse_os_name msg: | The OS of this server is not supported. - Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}} or {{os_major_version_3}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} or {{os_major_minor_version_3}} ) or {{suse_os_name}} at least version {{suse_os_major_minor_version}} + Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} ) or {{suse_os_name}} at least version {{suse_os_major_minor_version}} You seem to have {{ansible_os_family}} {{ansible_distribution_version}} - name: Ensure that the Operating System version is supported when on RedHat (this includes Oracle Linux) @@ -28,9 +28,7 @@ - ansible_distribution_major_version is version(os_major_version_1, '==') or ansible_distribution_major_version is version(os_major_version_2, '==') - or - ansible_distribution_major_version is version(os_major_version_3, '==') - # at least 6.7 if 6 or at least 7.1 if 7 or at least 8.0 if 8 + # at least 6.7 if 6 or at least 7.1 if 7 - (ansible_distribution_major_version is version(os_major_version_1, '==') and ansible_distribution_version is version(os_major_minor_version_1, '>=')) @@ -38,13 +36,9 @@ (ansible_distribution_major_version is version(os_major_version_2, '==') and ansible_distribution_version is version(os_major_minor_version_2, '>=')) - or - (ansible_distribution_major_version is version(os_major_version_3, '==') - and - ansible_distribution_version is version(os_major_minor_version_3, '>=')) msg: | The OS of this server is not supported. - Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}} or {{os_major_version_3}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} or {{os_major_minor_version_3}} ) + Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} ) You seem to have {{ansible_os_family}} {{ansible_distribution_version}} when: ansible_os_family == redhat_os_name diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.performance_config.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.performance_config.yml index 30bcc03..d253dce 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.performance_config.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.performance_config.yml @@ -32,7 +32,7 @@ kernel_SEMMSL: "{{ item.value }}" when: - item.name is match("kernel.sem.SEMMSL") - - item.value > kernel_SEMMSL + - item.value > kernel_SEMMSL|int with_items: - "{{ semaphores }}" @@ -41,7 +41,7 @@ kernel_SEMMNS: "{{ item.value }}" when: - item.name is match("kernel.sem.SEMMNS") - - item.value > kernel_SEMMNS + - item.value > kernel_SEMMNS|int with_items: - "{{ semaphores }}" @@ -50,7 +50,7 @@ kernel_SEMOPM: "{{ item.value }}" when: - item.name is match("kernel.sem.SEMOPM") - - item.value > kernel_SEMOPM + - item.value > kernel_SEMOPM|int with_items: - "{{ semaphores }}" @@ -59,7 +59,7 @@ kernel_SEMMNI: "{{ item.value }}" when: - item.name is match("kernel.sem.SEMMNI") - - item.value > kernel_SEMMNI + - item.value > kernel_SEMMNI|int with_items: - "{{ semaphores }}" diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.required_packages_config.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.required_packages_config.yml index 7db83bf..f19e22d 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.required_packages_config.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.required_packages_config.yml @@ -17,9 +17,29 @@ when: ((ansible_distribution == redhat_os_name|string or ansible_distribution == oracle_os_name|string) and viya_version is version('3.5','>=')) tags: - packages + - package_version_check + + + # Note that Oracle 7 distributions reflect being RedHat ansible_os_family + - name: Include OS Family specific package names + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_os_family }}.yml" + - default.yml + + + ## works for all OS Families + - name: Ensures required packages are present + package: + name: "{{ item }}" + state: present + with_items: + - "{{packages_general}}" + tags: + - packages - block: - ## block start determining supported version of java opensdk + ## block start determining supported version of java openjdk - name: Get what version of Java might be installed shell: java -version 2>&1 | grep version | awk '{print $3}' | sed 's/"//g' register: java_version @@ -43,44 +63,11 @@ # exec during check mode check_mode: no - # only exec the block when executing in check mode - when: ansible_check_mode |bool and viya_version is version('3.5','>=') + when: viya_version is version('3.5','>=') # end block tags: - jdk_check - - # Note that Oracle 7 distributions reflect being RedHat ansible_os_family - - name: Include OS Family specific package names - include_vars: "{{ item }}" - with_first_found: - - "{{ ansible_os_family }}.yml" - - default.yml - - ## works for all OS Families - - name: Ensures required packages are present - package: - name: "{{ item }}" - state: present - with_items: - - "{{packages_general}}" - tags: - - packages - - # Get and Show the version of Java installed. A help to debug java version issues. - - name: Get the installed version of Java - shell: java -version 2>&1 | grep version | awk '{print $3}' | sed 's/"//g' - register: java_version_present - check_mode: no - tags: - - packages - - - name: Show the installed version of Java - debug: var=java_version_present.stdout - tags: - - packages - - ## RHEL 6 specific - name: Ensures required RHEL6 packages are present package: diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/RedHat.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/RedHat.yml index 3811859..e5c8056 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/RedHat.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/RedHat.yml @@ -2,7 +2,6 @@ # OS specific package names for RedHat and OracleLinux java_openjdk_version: java-1.8.0-openjdk libXp_x86_64_pkg: libXp.x86_64 -libXp_i686_pkg: libXp.i686 libXext_pkg: libXext libXmu_pkg: libXmu libXtst_pkg: libXtst diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/Suse.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/Suse.yml index 5cfbd11..221a287 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/Suse.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/Suse.yml @@ -2,7 +2,6 @@ # OS specific package names for SuSE/SLES java_openjdk_version: java-1_8_0-openjdk libXp_x86_64_pkg: libXpm4 -libXp_i686_pkg: libXpm4 libXext_pkg: libXext6 libXmu_pkg: libXmu6 libXtst_pkg: libXtst6 diff --git a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/default.yml b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/default.yml index 5972edc..4b68384 100644 --- a/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/default.yml +++ b/playbooks/pre-install-playbook/roles/viya-ark.preinstall/vars/default.yml @@ -2,7 +2,6 @@ # OS specific package names for RedHat java_openjdk_version: java-1.8.0-openjdk libXp_x86_64_pkg: libXp.x86_64 -libXp_i686_pkg: libXp.i686 libXext_pkg: libXext libXmu_pkg: libXmu libXtst_pkg: libXtst diff --git a/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_controls.yml b/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_controls.yml index 8e66bee..c803111 100644 --- a/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_controls.yml +++ b/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_controls.yml @@ -38,7 +38,8 @@ bin_directory: "{{SASHOME}}/bin" httpd_host: "localhost" logfile_name: "delete_default_backup_schedule_job-{{ '%F_%H-%M-%S' | strftime(ansible_date_time.epoch) }}.log" - default_schedule_job_name: "DEFAULT_BACKUP_SCHEDULE" + backup_schedule_name: "DEFAULT_BACKUP_SCHEDULE" + backup_schedule_job_name: "DEFAULT_BACKUP_SCHEDULER_JOB" tag_value: 'delete-default-backup-job' profile_name: "{{ '__' + tag_value + '__' }}" @@ -51,15 +52,15 @@ Delete the Default Backup Schedule Job no_backup_job: > - This deployment did not contain a "Delete Default Backup Schedule" job. No action required. - + This deployment did not contain either DEFAULT_BACKUP_SCHEDULE or DEFAULT_BACKUP_SCHEDULER_JOB. No action required. + backup_service_not_deployed: > The Backup Service is not deployed in this environment. No action required. - + unknown_error: > An unexpected error occured while attempting to delete the DEFAULT_BACKUP_SCHEDULE job. Please see logs for more information. - + delete_skipped_warn_msg: > The "Delete Default Backup Schedule" job was not deleted because the playbooks/viya-upgrade/vars.yml file is missing the following variables: @@ -67,7 +68,6 @@ Then rerun this playbook with the tag {{ tag_value }}. play_not_needed_info_msg: > - "The Deleting of the DEFAULT_BACKUP_SCHEDULE job" action was skipped.

The deleting of the DEFAULT_BACKUP_SCHEDULE job was skipped because @@ -75,12 +75,21 @@ Additional Information for more detail. unsupported_os_msg: > - "The Deleting of the DEFAULT_BACKUP_SCHEDULE job" action was skipped.

The deleting of the DEFAULT_BACKUP_SCHEDULE job was skipped because These actions are not needed for the upgrade process to continue. Review the Ansible log or the Additional Information for more detail. + + successfully_deleted_both_msg: > + Both DEFAULT_BACKUP_SCHEDULE and DEFAULT_BACKUP_SCHEDULER_JOB have been deleted. Please review the log provided in the Additional Information section below for more details. + + successfully_deleted_backup_schedule_msg: > + DEFAULT_BACKUP_SCHEDULE has been deleted. Please review the log provided in the Additional Information section below for more details. + + successfully_deleted_back_scheduler_job_msg: > + DEFAULT_BACKUP_SCHEDULER_JOB has been deleted. Please review the log provided in the Additional Information section below for more details. + tasks: # There is no need to run this play, unless the operating system is Red Hat. - block: diff --git a/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_tasks.yml b/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_tasks.yml index a601841..d333f35 100644 --- a/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_tasks.yml +++ b/playbooks/viya-upgrade/pre_upgrade/delete_default_backup_schedule_job_tasks.yml @@ -102,10 +102,10 @@ state: absent delegate_to: localhost -# Get the job schedulers through a REST call -- name: "Get the scheduler job - {{ tenant_id | default('SAS provider') }}" +# Get the schedule through a REST call +- name: "Get the backup schedule - {{ tenant_id | default('SAS provider') }}" uri: - url: "{{ tenant_url }}jobExecution/jobRequests?filter=eq(name,'{{ default_schedule_job_name }}')" + url: "{{ tenant_url }}jobExecution/jobRequests?filter=eq(name,'{{ backup_schedule_name }}')" method: GET headers: Accept: application/vnd.sas.collection+json @@ -114,7 +114,21 @@ return_content: yes status_code: 200,404 validate_certs: no - register: job_requests_raw + register: schedule_raw + +# Get the scheduler job through a REST call +- name: "Get the backup scheduler job - {{ tenant_id | default('SAS provider') }}" + uri: + url: "{{ tenant_url }}scheduler/jobs?filter=eq(name,'{{ backup_schedule_job_name }}')" + method: GET + headers: + Accept: application/vnd.sas.collection+json + Authorization: "Bearer {{ sasuser_credentials[ profile_name ]['access-token'] }}" + body_format: json + return_content: yes + status_code: 200,404 + validate_certs: no + register: scheduler_job_raw - name: "Log if Backup server is not deployed." block: @@ -140,36 +154,69 @@ flat: yes - meta: end_play - - set_fact: - total_count: -1 - when: - - " job_requests_raw['status'] == 404 " + when: schedule_raw['status'] == 404 and scheduler_job_raw['status'] == 404 + +- name: "Check to see if DEFAULT_BACKUP_SCHEDULE is found" + set_fact: + total_job_count: -1 + when: schedule_raw['status'] == 404 + +- name: "Check to see if DEFAULT_BACKUP_SCHEDULER_JOB is found" + set_fact: + total_scheduler_count: -1 + when: scheduler_job_raw['status'] == 404 + + +# Get session dict from json response (DEFAULT_BACKUP_SCHEDULE) +- name: "Examine the REST response for the Backup Schedule Job." + block: + - set_fact: + job_request: "{{ schedule_raw.content | from_json }}" + - set_fact: + total_job_count={{ job_request.count }} + when: " schedule_raw['status'] == 200 " -# Get session dict from json response -- name: "Examine the REST response." +# Get session dict from json response (DEFAULT_BACKUP_SCHEDULER_JOB). +- name: "Examine the REST response for the Backup Scheduler Job." block: - set_fact: - job_request: "{{ job_requests_raw.content | from_json }}" + job_scheduler_request: "{{ scheduler_job_raw.content | from_json }}" - set_fact: - total_count={{ job_request.count }} - when: - total_count is not defined + total_scheduler_count={{ job_scheduler_request.count }} + when: " scheduler_job_raw['status'] == 200 " -#If we've found the job, delete it. -- name: "Delete the default job scheduler" +#If we've found DEFAULT_BACKUP_SCHEDULE, delete it. +- name: "Delete DEFAULT_BACKUP_SCHEDULE." block: - shell: cmd: | - echo -e "\n\nDelete the default scheduler:\n\n" >> {{ delete_backup_controls_tmpdir.path }}/{{ tenant_id | default('provider') + '_' + logfile_name }} + echo -e "\n\nDelete DEFAULT_BACKUP_SCHEDULE:\n" >> {{ delete_backup_controls_tmpdir.path }}/{{ tenant_id | default('provider') + '_' + logfile_name }} source {{ SASROOT }}/{{ tenant_id | default('viya') }}/config/consul.conf {{ bin_directory }}/sas-admin --profile {{ profile_name }} job requests delete --id "{{ job_request['items'][0].id }}" >> {{ delete_backup_controls_tmpdir.path }}/{{ tenant_id | default('provider') + '_' + logfile_name }} environment: "{{ cli_env }}" - when: total_count|int > 0 + when: total_job_count|int > 0 -- name: "Log if the DEFAULT_BACKUP_SCHEDULE isn't found." +#If we've found DEFAULT_BACKUP_SCHEDULER_JOB, delete it. +- name: "Delete DEFAULT_BACKUP_SCHEDULER_JOB." + block: + - shell: echo -e "\n\nDelete DEFAULT_BACKUP_SCHEDULER_JOB:\n" >> {{ delete_backup_controls_tmpdir.path }}/{{ tenant_id | default('provider') + '_' + logfile_name }} + - uri: + url: "{{ tenant_url }}scheduler/jobs/{{ job_scheduler_request['items'][0].id }}" + method: DELETE + headers: + Accept: application/vnd.sas.collection+json + Authorization: "Bearer {{ sasuser_credentials[ profile_name ]['access-token'] }}" + body_format: json + return_content: yes + status_code: 204,404 + validate_certs: no + - shell: echo -e "Deleted the scheduler job \"{{ job_scheduler_request['items'][0].id }}\"\n\n" >> {{ delete_backup_controls_tmpdir.path }}/{{ tenant_id | default('provider') + '_' + logfile_name }} + when: total_scheduler_count|int > 0 + +- name: "Log if the DEFAULT_BACKUP_SCHEDULE and DEFAULT_BACKUP_SCHEDULER_JOB aren't found." block: - debug: msg: "{{ no_backup_job }}" @@ -179,7 +226,7 @@ - header: "{{ delete_header }} - {{ tenant_id | default('SAS provider') }}" - message: "{{ no_backup_job }}" - additional_info_html: "Log file: {{ hostvars['localhost']['UPGRADE_OUTPUT_DIRECTORY'] + '/' + tenant_id | default('provider') + '_' + logfile_name }}" - when: total_count|int == 0 + when: total_job_count|int == 0 and total_scheduler_count==0 # Log off the server - name: "Log off {{ tenant_id | default('SAS provider') }}" @@ -197,11 +244,34 @@ dest: "{{ hostvars['localhost']['UPGRADE_OUTPUT_DIRECTORY'] }}/" flat: yes -# Add the entry to the summary report. +# Add the entry to the summary report (both objects deleted). +- include_tasks: ../common/add-summary-item-tasks.yml + vars: + - header: "{{ delete_header }} - {{ tenant_id | default('SAS provider') }}" + - message: "{{ successfully_deleted_both_msg }}" + - additional_info_html: "Log file: {{ hostvars['localhost']['UPGRADE_OUTPUT_DIRECTORY'] + '/' + tenant_id | default('provider') + '_' + logfile_name }}" + when: total_job_count|int > 0 and total_scheduler_count|int > 0 + +# Add the entry to the summary report (DEFAULT_BACKUP_SCHEDULE deleted only). - include_tasks: ../common/add-summary-item-tasks.yml vars: - header: "{{ delete_header }} - {{ tenant_id | default('SAS provider') }}" - - message: > - The Delete Default Backup Schedule Job has been deleted. Please review the log provided in the Additional Information section below for more details. + - message: "{{ successfully_deleted_backup_schedule_msg }}" + - additional_info_html: "Log file: {{ hostvars['localhost']['UPGRADE_OUTPUT_DIRECTORY'] + '/' + tenant_id | default('provider') + '_' + logfile_name }}" + when: total_job_count|int > 0 and total_scheduler_count|int < 1 + +# Add the entry to the summary report (DEFAULT_BACKUP_SCHEDULER_JOB deleted only). +- include_tasks: ../common/add-summary-item-tasks.yml + vars: + - header: "{{ delete_header }} - {{ tenant_id | default('SAS provider') }}" + - message: "{{ successfully_deleted_back_scheduler_job_msg }}" + - additional_info_html: "Log file: {{ hostvars['localhost']['UPGRADE_OUTPUT_DIRECTORY'] + '/' + tenant_id | default('provider') + '_' + logfile_name }}" + when: total_job_count|int < 1 and total_scheduler_count|int > 0 + +# Add the entry to the summary report (Neither existed). +- include_tasks: ../common/add-summary-item-tasks.yml + vars: + - header: "{{ delete_header }} - {{ tenant_id | default('SAS provider') }}" + - message: "{{ no_backup_job }}" - additional_info_html: "Log file: {{ hostvars['localhost']['UPGRADE_OUTPUT_DIRECTORY'] + '/' + tenant_id | default('provider') + '_' + logfile_name }}" - when: total_count|int > 0 \ No newline at end of file + when: total_job_count|int < 1 and total_scheduler_count|int < 1