-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(everything): overhaul to align with the template-formula
* see: https://github.com/saltstack-formulas/template-formula * systemd unit file:https://learn.hashicorp.com/vault/operations/ops-vault-ha-consul#vault-server-systemd-unit-file * currently the self-signed certificate part has not been ported but that can be done upon request BREAKING CHANGE: This renames all states and the config file being generated.
- Loading branch information
Showing
25 changed files
with
311 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
include: | ||
- .service.clean | ||
- .config.clean | ||
- .package.clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
vault-config-clean-file-absent: | ||
file.absent: | ||
- name: /etc/vault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
{% from "vault/map.jinja" import vault with context -%} | ||
|
||
vault-config-init-file-serialize: | ||
file.serialize: | ||
- name: /etc/vault/conf.d/config.json | ||
- encoding: utf-8 | ||
- formatter: json | ||
- dataset: {{ vault.config | json }} | ||
- user: root | ||
- group: vault | ||
- mode: 640 | ||
- makedirs: True | ||
- watch_in: | ||
- service: vault |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{%- from "vault/map.jinja" import vault with context -%} | ||
[Unit] | ||
Description=Vault secret management tool | ||
Requires=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
User=vault | ||
Group=vault | ||
PIDFile=/var/run/vault/vault.pid | ||
ExecStart=/usr/local/bin/vault server {% if vault.dev_mode %} -dev {% else %} -config=/etc/vault/conf.d {% endif %} | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
KillMode=process | ||
KillSignal=SIGTERM | ||
Restart=on-failure | ||
RestartSec=42s | ||
LimitMEMLOCK=infinity | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,7 @@ | ||
{% from "vault/map.jinja" import vault with context %} | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
{% set version = vault.version %} | ||
/opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS: | ||
file.managed: | ||
- source: https://releases.hashicorp.com/vault/{{ version }}/vault_{{ version }}_SHA256SUMS | ||
- makedirs: true | ||
- skip_verify: true | ||
/opt/vault/{{ version }}/bin: | ||
archive.extracted: | ||
- source: https://releases.hashicorp.com/vault/{{ version }}/vault_{{ version }}_linux_amd64.zip | ||
- source_hash: /opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS | ||
- enforce_toplevel: false | ||
- require: | ||
- /opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS | ||
/usr/local/bin/vault: | ||
file.symlink: | ||
- target: /opt/vault/{{ version }}/bin/vault | ||
- force: true | ||
- require: | ||
- /opt/vault/{{ version }}/bin | ||
{% if vault.secure_download -%} | ||
/opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS.sig: | ||
file.managed: | ||
- source: https://releases.hashicorp.com/vault/{{ version }}/vault_{{ version }}_SHA256SUMS.sig | ||
- skip_verify: true | ||
- require: | ||
- /opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS | ||
/tmp/hashicorp.asc: | ||
file.managed: | ||
- source: salt://vault/files/hashicorp.asc.jinja | ||
- template: jinja | ||
vault_gpg_pkg: | ||
pkg.installed: | ||
- name: {{ vault.gpg_pkg }} | ||
import key: | ||
cmd.run: | ||
- name: gpg --import /tmp/hashicorp.asc | ||
- unless: gpg --list-keys {{ vault.hashicorp_key_id }} | ||
- require: | ||
- /tmp/hashicorp.asc | ||
- vault_gpg_pkg | ||
verify shasums sig: | ||
cmd.run: | ||
- name: gpg --verify /opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS.sig /opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS | ||
- require: | ||
- /opt/vault/{{ version }}/vault_{{ version }}_SHA256SUMS.sig | ||
- import key | ||
- prereq: | ||
- /usr/local/bin/vault | ||
{%- endif %} | ||
include: | ||
- .package | ||
- .config | ||
- .service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
{% import_yaml "vault/defaults.yaml" as defaults %} | ||
{% import_yaml "vault/osfamilymap.yaml" as osfamilymap %} | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
{% import_yaml "vault/yaml/defaults.yaml" as defaults %} | ||
{% import_yaml "vault/yaml/osfamilymap.yaml" as osfamilymap %} | ||
{% import_yaml "vault/yaml/initfamilymap.yaml" as initfamilymap %} | ||
|
||
{% set vault = salt['grains.filter_by']( | ||
defaults, | ||
merge=salt['grains.filter_by']( | ||
osfamilymap, | ||
merge=salt['pillar.get']('vault', {}), | ||
), | ||
base='vault') | ||
%} | ||
defaults, merge=salt['grains.filter_by']( | ||
osfamilymap, merge=salt['grains.filter_by']( | ||
initfamilymap, grain='init', merge=salt['pillar.get']('vault', {}), | ||
base='vault'), | ||
base='vault'), | ||
base='vault') | ||
%} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
{% from "vault/map.jinja" import vault with context %} | ||
|
||
vault-package-clean-file-absent: | ||
file.absent: | ||
- name: /opt/vault | ||
|
||
vault-package-clean-file-absent-data: | ||
file.absent: | ||
- name: /var/lib/vault | ||
|
||
vault-package-clean-cmd-run: | ||
cmd.run: | ||
- name: gpg --batch --yes --delete-key {{ vault.hashicorp_key_id }} | ||
|
||
vault-package-clean-user-absent: | ||
user.absent: | ||
- name: vault | ||
|
||
vault-package-clean-group-absent: | ||
group.absent: | ||
- name: vault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
{% from "vault/map.jinja" import vault with context %} | ||
|
||
vault-package-gpg-file-managed: | ||
file.managed: | ||
- name: /opt/vault/hashicorp.asc | ||
- contents: | | ||
{{ vault.hashicorp_gpg_key | indent(8) }} | ||
- makedirs: True | ||
|
||
vault-package-gpg-pkg-installed: | ||
pkg.installed: | ||
- name: {{ vault.gpg_pkg }} | ||
|
||
vault-package-gpg-cmd-run: | ||
cmd.run: | ||
- name: gpg --import /opt/vault/hashicorp.asc | ||
- unless: gpg --list-keys {{ vault.hashicorp_key_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
|
||
{% from "vault/map.jinja" import vault with context %} | ||
|
||
include: | ||
- .install | ||
{%- if vault.verify_download %} | ||
- .gpg | ||
- .signature | ||
{%- endif %} |
Oops, something went wrong.