sassoftware / viya4-deployment

This project contains Ansible code that creates a baseline in an existing Kubernetes environment for use with the SAS Viya Platform, generates the manifest for an order, and then can also deploy that order into the Kubernetes environment specified.
Apache License 2.0
71 stars 64 forks source link

Download viya4-orders-cli task should be conditional #252

Closed hyweldaniels closed 1 year ago

hyweldaniels commented 2 years ago

When deploying to a dark site, the V4_CFG_DEPLOYMENT_ASSETS and V4_CFG_LICENSE configuration options are used to provide the paths to pre-downloaded assets and a pre-downloaded license file respectively. The expectation is that when these are used, the viya4-orders-cli should not be required.

There is conditional logic in https://github.com/sassoftware/viya4-deployment/blob/main/roles/vdm/tasks/assets.yaml to ensure that the assets and license file are only pulled when needed. However the viya4-orders-cli is always downloaded, regardless; https://github.com/sassoftware/viya4-deployment/blob/main/roles/vdm/tasks/assets.yaml#L3

For dark sites with no external access, this task will fail. Can a suitable conditional statement be added so that the download of the viya4-orders-cli is only attempted when required (i.e. when no assets or no license is specified in ansible-vars.yaml) ?

An example change is included below, which I have tested and verified.

- name: Download viya4-orders-cli
  get_url:
    url: "[https://github.com/sassoftware/viya4-orders-cli/releases/download/{{](https://github.com/sassoftware/viya4-orders-cli/releases/download/%7B%7B) V4_ORDERS_CLI_VERSION }}/viya4-orders-cli_{{ hostvars[inventory_hostname]['ansible_system']|lower }}_amd64"
    dest: "{{ tmpdir.path }}/viya4-orders-cli"
    mode: "0755"
  when:
    - V4_CFG_LICENSE is none or V4_CFG_DEPLOYMENT_ASSETS is none
  tags:
    - install
    - uninstall
    - update
thpang commented 2 years ago

The logic shows that if you have V4_CFG_LICENSE or V4_CFG_DEPLOYMENT_ASSESTS set it should not download the viya-order-cli From your comment you appear to be setting both of these correct?

hyweldaniels commented 2 years ago

Based on the contents of assets.yaml I figured that if either of V4_CFG_LICENSE or V4_CFG_DEPLOYMENT_ASSETS were not set/pre-downloaded, then the orders CLI was needed to download them. So I set the logic so that it either of them were not set in ansible-vars.yaml, then assume we need to download them and so need the orders CLI.

thpang commented 2 years ago

You logic is right based on the current docs; however, logic would indicate that you should set both if you are controlling the assets and license from a dark site. So the or statement you have should suffice. You can fork the repo and then create a pull request asking for the change with the code snippet you have above modified in your fork.

jarpat commented 1 year ago

Closing, fixed in the 6.2.0 release https://github.com/sassoftware/viya4-deployment/releases/tag/6.2.0