Skip to content

Commit b8fffb3

Browse files
authored
feat: add a way to upload license from variable (not file) (#378)
* feat: add task for uploading license from variable * docs: delete repeated vault_pkg documentation * docs: add vault_license_content variable documentation
1 parent 2619857 commit b8fffb3

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

defaults/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,13 @@ vault_configure_enterprise_license: false
402402
# https://www.vaultproject.io/docs/configuration#license_path
403403
vault_license_path: "{{ vault_config_path }}/license.hclic"
404404
# Path to enterprise license on the Ansible controller (source file for upload)
405-
# Upload skipped when empty or undefined
405+
# Upload skipped when empty or undefined, if `vault_license_file` is also empty or undefined
406+
# Only used if `vault_configure_enterprise_license: true`
406407
vault_license_file: ""
408+
# Value of the enterprise license to use
409+
# Upload skipped when empty or undefined, if `vault_license_file` is also empty or undefined
410+
# Only used if `vault_configure_enterprise_license: true`
411+
vault_license_content: ""
407412

408413
# -----------------
409414
# Vault plugins

role_variables.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -978,11 +978,6 @@ differences across distributions:
978978
- List of OS packages to install
979979
- Default value: list
980980

981-
## `vault_pkg`
982-
983-
- Vault package filename
984-
- Default value: `"{{ vault_version }}_linux_amd64.zip"`
985-
986981
## `vault_debian_url`
987982

988983
- Vault package download URL
@@ -1101,7 +1096,7 @@ The role can configure HSM based instances. Make sure to reference the [HSM supp
11011096

11021097
## `vault_configure_enterprise_license`
11031098

1104-
- Manage enterprise license file with this role. Set to `true` to use `vault_license_path` or `vault_license_file`.
1099+
- Manage enterprise license file with this role. Set to `true` to use `vault_license_path`, and `vault_license_file` or `vault_license_content`.
11051100
- Default value: false
11061101

11071102
## `vault_license_path`
@@ -1111,7 +1106,12 @@ The role can configure HSM based instances. Make sure to reference the [HSM supp
11111106

11121107
## `vault_license_file`
11131108

1114-
- Path to enterprise license on the Ansible controller (source file for upload). Upload skipped when empty or undefined. Only used if `vault_configure_enterprise_license: true`.
1109+
- Path to enterprise license on the Ansible controller (source file for upload). Upload skipped when empty or undefined, if `vault_license_content` is also empty or undefined. Only used if `vault_configure_enterprise_license: true`.
1110+
- Default value: ""
1111+
1112+
## `vault_license_content`
1113+
1114+
- Value of the enterprise license to use. Upload skipped when empty or undefined, if `vault_license_file` is also empty or undefined. Only used if `vault_configure_enterprise_license: true`.
11151115
- Default value: ""
11161116

11171117
## `vault_hsm_app`

tasks/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@
209209
- vault_configure_enterprise_license | bool
210210
- vault_license_file | length > 0
211211

212+
- name: Upload Vault license content to vault_license_path
213+
become: true
214+
copy:
215+
content: "{{ vault_license_content }}"
216+
dest: "{{ vault_license_path }}"
217+
owner: "{{ vault_user }}"
218+
group: "{{ vault_group }}"
219+
mode: "{{ vault_harden_file_perms | ternary('0400', '0644') }}"
220+
when:
221+
- vault_configure_enterprise_license | bool
222+
- vault_license_content | length > 0
223+
212224
- name: "Set Exec output to log path when enabled log"
213225
ansible.builtin.set_fact:
214226
vault_exec_output: ">> {{ vault_log_path }}/vault.log 2>&1"

0 commit comments

Comments
 (0)