Skip to content

Commit 7777c22

Browse files
author
Henry Mollman
committed
PR comments
1 parent 31be17c commit 7777c22

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

  • ansible/roles/dock_launch_config/templates

ansible/roles/dock_launch_config/templates/init.tmpl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ export CONSUL_PORT={{ consul_api_port }}
55
export CONSUL_HOSTNAME={{ consul_host_address }}
66
export VAULT_PORT={{ vault_port }}
77

8-
{% if ( S3_ACCESS_KEY is not defined or
9-
S3_SECRET_KEY is not defined or
10-
AWS_ACCESS_KEY is not defined or
11-
AWS_SECRET_KEY is not defined ) %}
8+
{% set has_token = ( s3_access_key is defined and
9+
s3_secret_key is defined and
10+
aws_access_key is defined and
11+
aws_secret_key is defined ) %}
12+
13+
{% if not has_token %}
1214
# Create directory for env
1315
mkdir -p /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}
1416
chown ubuntu:ubuntu /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}
@@ -18,9 +20,6 @@ chmod 0711 /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}
1820
{% for item in tokens %}
1921
echo {{ item.value }} > /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}/{{ item.file_name }}
2022
{% endfor %}
21-
{% set hasToken = false %}
22-
{% else %}
23-
{% set hasToken = true %}
2423
{% endif %}
2524

2625
# Add upstart files for charon and krain
@@ -42,8 +41,8 @@ start amazon-ssm-agent
4241
service krain start
4342
service charon start
4443
{% if not is_dock_pool %}
45-
{% if hasToken %}
46-
CONSUL_HOSTNAME={{ consul_host_address }} CONSUL_PORT={{ consul_api_port }} VAULT_PORT={{ vault_port }} S3_ACCESS_KEY={{ S3_ACCESS_KEY }} S3_SECRET_KEY={{ S3_SECRET_KEY }} AWS_ACCESS_KEY={{ AWS_ACCESS_KEY }} AWS_SECRET_KEY={{ AWS_SECRET_KEY }} bash /opt/runnable/dock-init/init.sh | tee /var/log/user-script-dock-init.log
44+
{% if has_token %}
45+
CONSUL_HOSTNAME={{ consul_host_address }} CONSUL_PORT={{ consul_api_port }} VAULT_PORT={{ vault_port }} S3_ACCESS_KEY={{ s3_access_key }} S3_SECRET_KEY={{ s3_secret_key }} AWS_ACCESS_KEY={{ aws_access_key }} AWS_SECRET_KEY={{ aws_secret_key }} bash /opt/runnable/dock-init/init.sh | tee /var/log/user-script-dock-init.log
4746
{% else %}
4847
CONSUL_HOSTNAME={{ consul_host_address }} CONSUL_PORT={{ consul_api_port }} VAULT_PORT={{ vault_port }} bash /opt/runnable/dock-init/init.sh | tee /var/log/user-script-dock-init.log
4948
{% endif %}

0 commit comments

Comments
 (0)