-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AWS instance metadata token is now valid only for 5 minutes
- Loading branch information
1 parent
01310bd
commit 45d478d
Showing
10 changed files
with
115 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Provision a machine | ||
hosts: 127.0.0.1 | ||
user: ec2-user | ||
connection: local | ||
roles: | ||
- 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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
consul_home: /opt/consul | ||
vault_home: /opt/vault | ||
consul_config_dir: /etc/consul.d | ||
consul_data_dir: "{{ consul_home }}/data" | ||
consul_user: consul | ||
consul_group: consul | ||
|
||
consul_url: "https://releases.hashicorp.com/consul/1.6.2/consul_1.6.2_linux_amd64.zip" | ||
vault_url: "https://releases.hashicorp.com/vault/0.7.0/vault_0.7.0_linux_amd64.zip" |
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 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
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,9 @@ | ||
--- | ||
# Versions | ||
vault_version: "1.5.0" | ||
# Download dirs | ||
tmp_dir: "/tmp" | ||
bin_dir: "/usr/local/bin" | ||
# vault | ||
vault_url: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version }}_linux_amd64.zip" | ||
vault_dest: "{{ tmp_dir }}/vault_{{ vault_version }}_linux_amd64.zip" |
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 @@ | ||
[Unit] | ||
Description=Vault Agent | ||
Requires=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
Restart=on-failure | ||
PermissionsStartOnly=true | ||
ExecStartPre=/sbin/setcap 'cap_ipc_lock=+ep' /usr/local/bin/vault | ||
ExecStart=/usr/local/bin/vault server -config /etc/vault.d | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
KillSignal=SIGTERM | ||
User=vault | ||
Group=vault | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,68 @@ | ||
--- | ||
- name: create vault group | ||
group: | ||
name: vault | ||
|
||
- name: create vault user and make vault its primary group | ||
user: | ||
name: vault | ||
group: vault | ||
system: yes | ||
comment: Hashicorp vault user | ||
home: /srv/vault | ||
shell: /bin/false | ||
|
||
- name: disable core dumps | ||
shell: | | ||
echo 'ulimit -c 0 > /dev/null 2>&1' > /etc/profile.d/disable-coredumps.sh | ||
- name: Adjusting ulimits for vault user | ||
pam_limits: | ||
domain: vault | ||
limit_type: "{{ item.type }}" | ||
limit_item: "{{ item.item }}" | ||
value: 65536 | ||
loop: | ||
- { type: "soft", item: "nofile" } | ||
- { type: "hard", item: "nofile" } | ||
- { type: "soft", item: "nproc" } | ||
- { type: "hard", item: "nproc" } | ||
|
||
- name: download vault | ||
get_url: | ||
url: "{{ item.url }}" | ||
dest: "{{ item.dest }}" | ||
mode: 0755 | ||
loop: | ||
- { url: "{{ vault_url }}", dest: "{{ vault_dest }}" } | ||
|
||
- name: extract vault and place it on PATH | ||
unarchive: | ||
src: "{{ vault_dest }}" | ||
dest: "{{ bin_dir }}/" | ||
remote_src: yes | ||
|
||
- name: change vault ownership, group and permissions | ||
file: | ||
path: "{{ bin_dir }}/vault" | ||
owner: vault | ||
group: vault | ||
mode: 0755 | ||
|
||
- name: copy vault systemd unit | ||
copy: | ||
src: etc/systemd/system/vault.service | ||
dest: /etc/systemd/system/vault.service | ||
mode: 0644 | ||
|
||
|
||
- name: create vault config directory | ||
file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: vault | ||
group: vault | ||
mode: 0755 | ||
loop: | ||
- /etc/vault.d | ||
- /var/log/vault |