system-config/playbooks/roles/hashivault/tasks/configure_plugins.yaml
2023-03-29 13:35:19 +02:00

42 lines
1.1 KiB
YAML

- name: Register the plugin {{ plugin.name }} with sha256 {{ plugin.sha256 }}
become: true
command: "vault plugin register -sha256={{ plugin.sha256 }} {{ plugin.type }} {{ plugin.name }}"
when:
- "plugin.name is defined"
- "plugin.type is defined"
- "plugin.sha256 is defined"
- name: Enable the plugin on defined paths
become: true
command: "vault secrets enable -path={{ path }} {{ plugin.name }}"
loop: "{{ plugin.paths }}"
loop_control:
loop_var: "path"
when:
- "plugin.paths is defined"
- "plugin.name is defined"
ignore_errors: true
- name: Reload the plugin in case of a new version
become: true
command: "vault plugin reload -plugin {{ plugin.name }}"
when:
- "plugin.name is defined"
- name: Get loaded plugin info
become: true
command: "vault plugin info {{ plugin.type}} {{ plugin.name }}"
when:
- "plugin.type is defined"
- "plugin.name is defined"
register: plugin_info
- name: Loaded plugin info
become: true
debug:
msg: "{{ plugin_info.stdout_lines }}"
when:
- "plugin_info.stdout_lines is defined"