-
Notifications
You must be signed in to change notification settings - Fork 59
/
assets.yaml
152 lines (139 loc) · 3.9 KB
/
assets.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Copyright © 2020-2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
---
- name: Assets - Download viya4-orders-cli
get_url:
url: https://github.com/sassoftware/viya4-orders-cli/releases/download/{{ 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_CERTS is none) or (V4_CFG_DEPLOYMENT_ASSETS is none)
tags:
- install
- uninstall
- update
- name: Assets - Set facts
set_fact:
LICENSE_DIRECTORY: "{{ BASE_DIR | regex_replace('\\/$', '') }}/{{ CLUSTER_NAME }}/{{ NAMESPACE }}/license"
tags:
- install
- uninstall
- update
- cas-onboard
- offboard
- name: Assets - create license directory
file:
path: "{{ LICENSE_DIRECTORY }}"
state: directory
mode: "0770"
tags:
- install
- uninstall
- update
- name: Assets - Get License
command:
cmd: "{{ tmpdir.path }}/viya4-orders-cli license --file-path {{ LICENSE_DIRECTORY }} --file-name license {{ V4_CFG_ORDER_NUMBER }} {{ V4_CFG_CADENCE_NAME }} {{
V4_CFG_CADENCE_VERSION }}"
environment:
CLIENTCREDENTIALSID: "{{ V4_CFG_SAS_API_KEY | string | b64encode }}"
CLIENTCREDENTIALSSECRET: "{{ V4_CFG_SAS_API_SECRET | string | b64encode }}"
when:
- V4_CFG_LICENSE is none
tags:
- install
- uninstall
- update
- name: Assets - Get Certificates
command:
cmd: "{{ tmpdir.path }}/viya4-orders-cli certificates --file-path {{ LICENSE_DIRECTORY }} --file-name certs {{ V4_CFG_ORDER_NUMBER }}"
environment:
CLIENTCREDENTIALSID: "{{ V4_CFG_SAS_API_KEY | string | b64encode }}"
CLIENTCREDENTIALSSECRET: "{{ V4_CFG_SAS_API_SECRET | string | b64encode }}"
when:
- V4_CFG_CERTS is none
tags:
- install
- uninstall
- update
- name: Assets - Download
command:
cmd: "{{ tmpdir.path }}/viya4-orders-cli dep --file-path {{ DEPLOY_DIR }} -o json {{ V4_CFG_ORDER_NUMBER }} {{ V4_CFG_CADENCE_NAME }} {{ V4_CFG_CADENCE_VERSION
}}"
environment:
CLIENTCREDENTIALSID: "{{ V4_CFG_SAS_API_KEY | string | b64encode }}"
CLIENTCREDENTIALSSECRET: "{{ V4_CFG_SAS_API_SECRET | string | b64encode }}"
when:
- V4_CFG_DEPLOYMENT_ASSETS is none
tags:
- install
- uninstall
- update
register: res
- name: Assets - Set assets location
set_fact:
order_output: "{{ res.stdout | from_json }}"
when:
- V4_CFG_DEPLOYMENT_ASSETS is none
tags:
- install
- uninstall
- update
- name: Assets - Remove old files
file:
path: "{{ item }}"
state: absent
with_items:
- "{{ DEPLOY_DIR }}/sas-bases"
- "{{ DEPLOY_DIR }}/site-config/vdm"
- "{{ DEPLOY_DIR }}/site-config/operator-deploy"
tags:
- install
- uninstall
- update
- name: Assets - Extract downloaded assets
unarchive:
src: "{{ order_output.assetLocation }}"
dest: "{{ DEPLOY_DIR }}"
when:
- V4_CFG_DEPLOYMENT_ASSETS is none
tags:
- install
- uninstall
- update
- name: Assets - Extract user-provided assets
unarchive:
src: "{{ V4_CFG_DEPLOYMENT_ASSETS }}"
dest: "{{ DEPLOY_DIR }}"
when:
- V4_CFG_DEPLOYMENT_ASSETS is not none
tags:
- install
- uninstall
- update
- name: Assets - Copy user-provided license file
copy:
src: "{{ V4_CFG_LICENSE }}"
dest: "{{ LICENSE_DIRECTORY }}/license.jwt"
when:
- V4_CFG_LICENSE is not none
tags:
- install
- uninstall
- update
- name: Assets - Copy user-provided certs file
copy:
src: "{{ V4_CFG_CERTS }}"
dest: "{{ LICENSE_DIRECTORY }}/certs.zip"
when:
- V4_CFG_CERTS is not none
tags:
- install
- uninstall
- update
- name: Assets - Set LICENSE_CONTENT
set_fact:
LICENSE_CONTENT: "{{ lookup('file', '{{ LICENSE_DIRECTORY }}/license.jwt') }}"
tags:
- install
- uninstall
- update