feat(installation): Enterprise license check

This commit is contained in:
Rajesh Rajendran 2021-05-25 13:53:20 +05:30
parent 0fb7e4bd07
commit c5c7764212
5 changed files with 40 additions and 3 deletions

View file

@ -17,6 +17,20 @@ domain_name=`grep domain_name vars.yaml | grep -v "example" | cut -d " " -f2 | c
}
}
[[ $1 == "ee" ]] || {
[[ $2 == "" ]] || {
sed -i "s#enterprise_edition_license.*#enterprise_edition_license: ${2}#g" vars.yaml
} && {
echo """Enerprise key is missing.
Usage: ./install.sh ee XXXXXXXXXXXXX
"""
exit 1
}
}
# https://parrot.asayer.io/os/license
# payload: {"mid": "UUID of the machine", "license": ""}
# response {"data":{"valid": TRUE|FALSE, "expiration": expiration date in ms}}
# Installing k3s
curl -sL https://get.k3s.io | sudo K3S_KUBECONFIG_MODE="644" INSTALL_K3S_VERSION='v1.19.5+k3s2' INSTALL_K3S_EXEC="--no-deploy=traefik" sh -

View file

@ -6,4 +6,3 @@ db_list:
- "nfs-server-provisioner"
- "postgresql"
- "redis"
enterprise_edition: false

View file

@ -24,7 +24,7 @@
delay: 60
register: result
until: result.rc == 0
when: enterprise_edition
when: enterprise_edition_license|length > 0
- name: Restoring postgres data
shell: |
file="{{ item|basename }}"
@ -53,7 +53,7 @@
delay: 60
register: result
until: result.rc == 0
when: enterprise_edition
when: enterprise_edition_license|length > 0
- name: Initializing Minio
shell: |
minio_pod=$(kubectl get po -n db -l app.kubernetes.io/name=minio -n db --output custom-columns=name:.metadata.name | tail -n+2)

View file

@ -108,3 +108,23 @@
- pre-check
- nginx
- all
- name: Checking Enterprise Licence
uri:
url: https://parrot.asayer.io/os/license
body:
mid: "UUID of the machine"
license: "{{ enterprise_edition_license }}"
body_format: json
creates: "{{ ansible_env.HOME }}/.config/openreplay.license"
follow_redirects: yes
force: false
http_agent: ansible-httpget
method: POST
return_content: true
status_code: [200]
timeout: 30
unsafe_writes: false
validate_certs: true
when: enterprise_edition_license|length > 0
register: enterprise_edition_license_check
failed_when: enterprise_edition_license_check.json.data.valid != true

View file

@ -57,3 +57,7 @@ enable_monitoring: "false"
# `openssl rand -base64 30`
minio_access_key: ""
minio_secret_key: ""
# If you're using enterprise edition.
# Insert the enterprise_edition_License key which you got.
enterprise_edition_license: ""