diff --git a/docs/itential_gateway_guide.md b/docs/itential_gateway_guide.md index 1b600488..f6ffb881 100644 --- a/docs/itential_gateway_guide.md +++ b/docs/itential_gateway_guide.md @@ -74,6 +74,7 @@ The following table lists the default variables located in `roles/gateway/defaul | `gateway_ssl_rootca_dest` | String | The SSL root CA destination. | `{{ gateway_ssl_dir }}/{{ gateway_ssl_rootca_src }}` | | `gateway_tlsv1_2` | Boolean | Flag to enable TLS 1.2. | `false` | | `gateway_http_server_threads` | Integer | The number of http server threads for handling requests. | `{{ ansible_processor_cores * 4 }}` | +| `gateway_license_key` | String | License key string that will be added to the gateway properties file. Only added when the variable is defined and not empty. | `""` | ## Gateway HAProxy Role Variables @@ -174,6 +175,23 @@ all: gateway_haproxy_enabled: true ``` +## Example Inventory - IAG with License Key + +To configure IAG with a license key, add the `gateway_license_key` variable to the `gateway` group: + +```yaml +all: + children: + gateway: + hosts: + : + ansible_host: + vars: + gateway_release: 2023.1 + gateway_whl_file: + gateway_license_key: "your-license-key-string" +``` + ## Running the Playbook To execute all Gateway roles, run the `gateway` playbook: diff --git a/docs/itential_platform_guide.md b/docs/itential_platform_guide.md index fc614610..d37ee0c9 100644 --- a/docs/itential_platform_guide.md +++ b/docs/itential_platform_guide.md @@ -281,6 +281,7 @@ located in `roles/platform/defaults/main/platform.yml`. | platform_npm_ignore_scripts | Boolean | Flag to prevent the NPM scripts from running when running the NPM install. | `true` | | platform_app_artifacts_enabled | Boolean | Flag to install app-artifacts. | `false` | | platform_start_service | Boolean | Flag to determine if the Itential Platform service is started. | `true` | +| platform_license_key_file | String | Path to the license key file that will be copied to /opt/pronghorn/current/license.txt after platform installation. Only copies when the variable is defined and not empty. | `""` | #### Server Variables @@ -404,6 +405,28 @@ all: platform_vault_url: http://hashi-vault-example.com:8200 ``` +### Example Inventory - Deploy Platform License + +To deploy a platform license file during installation, set the `platform_license_key_file` variable to the path of your license file: + +```yaml +all: + vars: + platform_release: 6 + + children: + platform: + hosts: + : + ansible_host: + vars: + platform_encryption_key: # 64-length hex string, representing a 256-bit AES encryption key. + platform_packages: + - + - + platform_license_key_file: /path/to/your/license.txt +``` + ## Running the Playbook To execute all Platform roles, run the `platform` playbook: @@ -421,6 +444,7 @@ The Platform playbook and role supports the following tags: | install_nodejs | Install NodeJS | | install_python | Install Python | | install_platform | Install Itential Platform | +| copy_license | Copy license file to platform directory (only when platform_license_key_file is defined) | | install_adapters | Install Itential Platform adapters | | install_app_artifacts | Install Itential Platform App Artifacts | | configure_selinux | Configure SELinux | diff --git a/roles/gateway/defaults/main/gateway.yml b/roles/gateway/defaults/main/gateway.yml index 4ec39c37..1a8bbc61 100644 --- a/roles/gateway/defaults/main/gateway.yml +++ b/roles/gateway/defaults/main/gateway.yml @@ -56,3 +56,6 @@ gateway_http_server_threads: "{{ ansible_processor_cores * 4 }}" # Python virtual environment settings gateway_venv_name: venv gateway_python_venv: "{{ gateway_install_dir }}/{{ gateway_venv_name }}" + +# License key string to be added to properties files +gateway_license_key: "" diff --git a/roles/gateway/templates/properties.2021.1.yml.j2 b/roles/gateway/templates/properties.2021.1.yml.j2 index 8c498334..f83dd70c 100644 --- a/roles/gateway/templates/properties.2021.1.yml.j2 +++ b/roles/gateway/templates/properties.2021.1.yml.j2 @@ -11,6 +11,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # The port on which Automation Gateway server will listen for requests. # Mutually exclusive with bind_list port: {{ gateway_port }} diff --git a/roles/gateway/templates/properties.2021.2.yml.j2 b/roles/gateway/templates/properties.2021.2.yml.j2 index 7aa0271e..167dba3c 100644 --- a/roles/gateway/templates/properties.2021.2.yml.j2 +++ b/roles/gateway/templates/properties.2021.2.yml.j2 @@ -11,6 +11,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # The port on which Automation Gateway server will listen for requests. # Mutually exclusive with bind_list port: {{ gateway_port }} diff --git a/roles/gateway/templates/properties.2022.1.yml.j2 b/roles/gateway/templates/properties.2022.1.yml.j2 index 03948bc6..9fa15e07 100644 --- a/roles/gateway/templates/properties.2022.1.yml.j2 +++ b/roles/gateway/templates/properties.2022.1.yml.j2 @@ -11,6 +11,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # The port on which Automation Gateway server will listen for requests. # Mutually exclusive with bind_list port: {{ gateway_port }} diff --git a/roles/gateway/templates/properties.2023.1.yml.j2 b/roles/gateway/templates/properties.2023.1.yml.j2 index 1dde9850..7c95cf54 100644 --- a/roles/gateway/templates/properties.2023.1.yml.j2 +++ b/roles/gateway/templates/properties.2023.1.yml.j2 @@ -11,6 +11,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # The port on which Automation Gateway server will listen for requests. # Mutually exclusive with bind_list {% if gateway_https %} diff --git a/roles/gateway/templates/properties.2023.2.yml.j2 b/roles/gateway/templates/properties.2023.2.yml.j2 index 7e6b7e65..216050de 100644 --- a/roles/gateway/templates/properties.2023.2.yml.j2 +++ b/roles/gateway/templates/properties.2023.2.yml.j2 @@ -11,6 +11,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # The port on which Automation Gateway server will listen for requests. # Mutually exclusive with bind_list {% if gateway_https %} diff --git a/roles/gateway/templates/properties.2023.3.yml.j2 b/roles/gateway/templates/properties.2023.3.yml.j2 index d5b7e4c7..fdbf6f1f 100644 --- a/roles/gateway/templates/properties.2023.3.yml.j2 +++ b/roles/gateway/templates/properties.2023.3.yml.j2 @@ -12,6 +12,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # INVENTORY ENCRYPTION # Set the Fernet encryption key to have IAG encrypt device variables['password'] # ANYONE THAT HAS THIS KEY CAN DECRYPT YOUR PASSWORDS - PROTECT IT! diff --git a/roles/gateway/templates/properties.4.3.yml.j2 b/roles/gateway/templates/properties.4.3.yml.j2 index 0979f3e8..62e275c2 100644 --- a/roles/gateway/templates/properties.4.3.yml.j2 +++ b/roles/gateway/templates/properties.4.3.yml.j2 @@ -12,6 +12,11 @@ # System # ########## +{% if gateway_license_key is defined and gateway_license_key != "" and gateway_license_key is not none %} +# License key +license_key: '{{ gateway_license_key }}' + +{% endif %} # INVENTORY ENCRYPTION # Set the Fernet encryption key to have IAG encrypt device variables['password'] # ANYONE THAT HAS THIS KEY CAN DECRYPT YOUR PASSWORDS - PROTECT IT! diff --git a/roles/platform/defaults/main/platform.yml b/roles/platform/defaults/main/platform.yml index 4ad71e11..304c5aea 100644 --- a/roles/platform/defaults/main/platform.yml +++ b/roles/platform/defaults/main/platform.yml @@ -52,3 +52,6 @@ platform_app_artifacts_enabled: false # Flag to determine if the service is started platform_start_service: true + +# Path to the license key file that will be copied to /opt/pronghorn/current/license.txt +platform_license_key_file: "" diff --git a/roles/platform/tasks/main.yml b/roles/platform/tasks/main.yml index 00ead95d..7e5f2d49 100644 --- a/roles/platform/tasks/main.yml +++ b/roles/platform/tasks/main.yml @@ -72,6 +72,19 @@ ansible.builtin.include_tasks: file: install-platform.yml + - name: Copy Platform License + when: platform_license_key_file is defined and platform_license_key_file != "" + tags: copy_license + block: + - name: Copy license file to platform directory + ansible.builtin.copy: + src: "{{ platform_license_key_file }}" + dest: /opt/itential/platform/server/license.txt + owner: "{{ platform_user }}" + group: "{{ platform_group }}" + mode: "0644" + backup: true + - name: Install Adapters tags: install_adapters block: