Skip to content

Commit

Permalink
add license_key feature
Browse files Browse the repository at this point in the history
  • Loading branch information
slarimore02 committed Mar 10, 2023
1 parent 6a8c347 commit da256dd
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ No modules.
| <a name="input_firewall_controller_allow_source_range"></a> [firewall\_controller\_allow\_source\_range](#input\_firewall\_controller\_allow\_source\_range) | The IP range allowed to connect to the Avi Controller. Access from all IP ranges will be allowed by default | `string` | `"0.0.0.0/0"` | no |
| <a name="input_firewall_se_data_rules"></a> [firewall\_se\_data\_rules](#input\_firewall\_se\_data\_rules) | The ports allowed for Virtual Services hosted on Services Engines. The configure\_firewall\_se\_data variable must be set to true for this rule to be created | `list(object({ protocol = string, port = list(string) }))` | <pre>[<br> {<br> "port": [<br> "443",<br> "53"<br> ],<br> "protocol": "tcp"<br> },<br> {<br> "port": [<br> "53"<br> ],<br> "protocol": "udp"<br> }<br>]</pre> | no |
| <a name="input_firewall_se_data_source_range"></a> [firewall\_se\_data\_source\_range](#input\_firewall\_se\_data\_source\_range) | The IP range allowed to access Virtual Services hosted on Service Engines. The configure\_firewall\_se\_data and firewall\_se\_data\_rules variables must also be set | `string` | `"0.0.0.0/0"` | no |
| <a name="input_license_key"></a> [license\_key](#input\_license\_key) | The license key that will be applied when the tier is set to ENTERPRISE with the license\_tier variable | `string` | `""` | no |
| <a name="input_license_tier"></a> [license\_tier](#input\_license\_tier) | The license tier to use for Avi. Possible values are ENTERPRISE\_WITH\_CLOUD\_SERVICES or ENTERPRISE | `string` | `"ENTERPRISE_WITH_CLOUD_SERVICES"` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | This prefix is appended to the names of the Controller and SEs | `string` | n/a | yes |
| <a name="input_network_project"></a> [network\_project](#input\_network\_project) | The GCP Network project that the Controller and SEs will use. If not set the project variable will be used | `string` | `""` | no |
Expand Down
10 changes: 9 additions & 1 deletion files/ansible/avi-cloud-services-registration.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@
until: register_controller is not failed
retries: 10
delay: 10
register: register_controller
register: register_controller

- name: Delete Trial Avi License when Controller is registered successfully
avi_api_session:
avi_credentials: "{{ avi_credentials }}"
http_method: delete
path: "licensing/Eval"
when: register_controller is not failed
ignore_errors: yes
22 changes: 21 additions & 1 deletion files/ansible/avi-controller-gcp-all-in-one-play.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
api_version: ${avi_version}
cloud_name: "Default-Cloud"
license_tier: ${license_tier}
license_key: ${license_key}
controller_ip:
${ indent(6, yamlencode(controller_ip))}
%{ if cluster_ip != null ~}
Expand Down Expand Up @@ -122,7 +123,26 @@
redirect_to_https: true
use_uuid_from_input: false
welcome_workflow_complete: true


- name: Apply Avi License for ENTERPRISE Tier
avi_api_session:
avi_credentials: "{{ avi_credentials }}"
http_method: put
path: "licensing"
data:
serial_key: "{{ license_key }}"
when: license_tier == "ENTERPRISE" and license_key != ""
register: license
ignore_errors: yes

- name: Delete Trial Avi License when license is added successfully
avi_api_session:
avi_credentials: "{{ avi_credentials }}"
http_method: delete
path: "licensing/Eval"
when: license_tier == "ENTERPRISE" and license_key != "" and license.failed != true
ignore_errors: yes

- name: Configure Cloud
avi_cloud:
avi_credentials: "{{ avi_credentials }}"
Expand Down
1 change: 1 addition & 0 deletions gcp-compute.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ locals {
avi_upgrade = var.avi_upgrade
cluster_ip = var.cluster_ip
license_tier = var.license_tier
license_key = var.license_key
}
controller_sizes = {
small = "custom-8-24576"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ variable "license_tier" {
error_message = "The license_tier variable must be ENTERPRISE_WITH_CLOUD_SERVICES or ENTERPRISE."
}
}
variable "license_key" {
description = "The license key that will be applied when the tier is set to ENTERPRISE with the license_tier variable"
type = string
default = ""
}
variable "cluster_ip" {
description = "Sets the IP address of the Avi Controller cluster. This address must be in the same subnet as the Avi Controller VMs."
type = string
Expand Down

0 comments on commit da256dd

Please sign in to comment.