2017-04-11 10:55:31 -04:00
|
|
|
{% from "vault/map.jinja" import vault with context %}
|
2017-04-24 10:48:25 -04:00
|
|
|
{%- if vault.self_signed_cert.enabled %}
|
2017-04-11 09:58:37 -04:00
|
|
|
/usr/local/bin/self-cert-gen.sh:
|
|
|
|
file.managed:
|
2017-04-11 10:55:31 -04:00
|
|
|
- source: salt://vault/files/cert-gen.sh.jinja
|
2017-04-11 09:58:37 -04:00
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 644
|
|
|
|
|
2017-04-11 10:55:31 -04:00
|
|
|
generate self signed SSL certs:
|
2017-04-11 09:58:37 -04:00
|
|
|
cmd.run:
|
2017-04-11 10:55:31 -04:00
|
|
|
- name: bash /usr/local/bin/cert-gen.sh {{ vault.self_signed_cert.hostname }} {{ vault.self_signed_cert.password }}
|
2017-04-11 09:58:37 -04:00
|
|
|
- cwd: /etc/vault
|
|
|
|
- require:
|
|
|
|
- file: /usr/local/bin/self-cert-gen.sh
|
2017-04-24 10:48:25 -04:00
|
|
|
{% endif -%}
|
|
|
|
|
|
|
|
/etc/vault:
|
|
|
|
file.directory:
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 755
|
2017-04-28 16:02:17 -04:00
|
|
|
|
2017-04-24 10:48:25 -04:00
|
|
|
/etc/vault/config:
|
|
|
|
file.directory:
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 755
|
|
|
|
- require:
|
|
|
|
- file: /etc/vault
|
2017-04-11 09:58:37 -04:00
|
|
|
|
|
|
|
/etc/vault/config/server.hcl:
|
|
|
|
file.managed:
|
2017-04-11 10:55:31 -04:00
|
|
|
- source: salt://vault/files/server.hcl.jinja
|
2017-04-11 09:58:37 -04:00
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 644
|
2017-04-24 10:48:25 -04:00
|
|
|
- require:
|
|
|
|
- file: /etc/vault/config
|
2017-04-11 09:58:37 -04:00
|
|
|
|
2017-04-24 10:48:25 -04:00
|
|
|
{%- if vault.service.type == 'systemd' %}
|
|
|
|
/etc/systemd/system/vault.service:
|
2017-04-11 09:58:37 -04:00
|
|
|
file.managed:
|
2017-04-24 10:48:25 -04:00
|
|
|
- source: salt://vault/files/vault_systemd.service.jinja
|
2017-04-11 09:58:37 -04:00
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 644
|
2017-04-24 10:48:25 -04:00
|
|
|
- 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 -%}
|
2017-04-11 09:58:37 -04:00
|
|
|
|
|
|
|
vault:
|
|
|
|
service.running:
|
|
|
|
- enable: True
|
|
|
|
- require:
|
2017-04-24 10:48:25 -04:00
|
|
|
{%- if vault.self_signed_cert.enabled %}
|
2017-04-11 10:55:31 -04:00
|
|
|
- cmd: generate self signed SSL certs
|
2017-04-24 10:48:25 -04:00
|
|
|
{% endif -%}
|
2017-04-11 09:58:37 -04:00
|
|
|
- file: /etc/vault/config/server.hcl
|