68 lines
1.6 KiB
Text
68 lines
1.6 KiB
Text
{% from "vault/map.jinja" import vault with context %}
|
|
{%- if vault.self_signed_cert.enabled %}
|
|
/usr/local/bin/self-cert-gen.sh:
|
|
file.managed:
|
|
- source: salt://vault/files/cert-gen.sh.jinja
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- mode: 644
|
|
|
|
generate self signed SSL certs:
|
|
cmd.run:
|
|
- name: bash /usr/local/bin/cert-gen.sh {{ vault.self_signed_cert.hostname }} {{ vault.self_signed_cert.password }}
|
|
- cwd: /etc/vault
|
|
- require:
|
|
- file: /usr/local/bin/self-cert-gen.sh
|
|
{% endif -%}
|
|
|
|
/etc/vault.d:
|
|
file.directory:
|
|
- user: root
|
|
- group: root
|
|
- mode: 755
|
|
|
|
/etc/vault.d/config.hcl:
|
|
file.managed:
|
|
- source: salt://vault/files/config.hcl.jinja
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- mode: 644
|
|
- require:
|
|
- file: /etc/vault.d
|
|
|
|
{%- if vault.service.type == 'systemd' %}
|
|
/etc/systemd/system/vault.service:
|
|
file.managed:
|
|
- source: salt://vault/files/vault_systemd.service.jinja
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- mode: 644
|
|
- require_in:
|
|
- service: vault
|
|
|
|
{% elif vault.service.type == 'upstart' %}
|
|
/etc/init/vault.conf:
|
|
file.managed:
|
|
- source: salt://vault/files/vault_upstart.conf.jinja
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- require_in:
|
|
- service: vault
|
|
{% endif -%}
|
|
|
|
vault:
|
|
service.running:
|
|
- enable: True
|
|
- require:
|
|
{%- if vault.self_signed_cert.enabled %}
|
|
- cmd: generate self signed SSL certs
|
|
{% endif %}
|
|
- file: /etc/vault.d/config.hcl
|
|
- cmd: install vault
|
|
- onchanges:
|
|
- cmd: install vault
|
|
- file: /etc/vault.d/config.hcl
|