Skip to content

Commit 9fdb5ca

Browse files
committed
Merge branch 'master' of github.com:CodeNow/devops-scripts into add-web-and-enterprise-sign-in
* 'master' of github.com:CodeNow/devops-scripts: Change variable names for ansible variables in dock launch script Change vars names. Remove unused ENVs PR comments PR comments Vault tokens will only be added to the user-data script and then to the instance if the AWS/S3 keys are not provided Update README.md Update README.md
2 parents 5cf964a + 955aa8e commit 9fdb5ca

4 files changed

Lines changed: 27 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ https://github.com/CodeNow/devops-scripts
1818
3. Change to the devops scripts repo directory and run the following command:
1919
`ln -s /<local-path-to-devops-scripts>/ssh/config ~/.ssh/config`
2020

21-
4. Obtain the “Keys of Power” from someone who can already deploy (ask Anand if you don’t know). Depending on what you want to deploy you'll receive `*.pem` files.
21+
4. Obtain the "Ansible Secrets" zip from one password
2222

23-
5. Move the “Keys of Power” .pem files to your `~/.ssh` directory
23+
5. Unzip file obtained above into `devops-scripts/ansible/secrets`
2424

25-
6. Install two required tools onto your machine:
25+
6. Copy the `*.pem` files from `devops-scripts/ansible/secrets` to your `~/.ssh` directory
26+
27+
7. Install two required tools onto your machine:
2628
```bash
2729
brew update && brew install vault daemon
2830
```

ansible/roles/builder/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
tags: [ deploy ]
5656
become: true
5757
copy:
58-
src=../../../secrets/docker-client/{{ file_name_item }}
58+
src=./secrets/docker-client/{{ file_name_item }}
5959
dest={{ build_dir }}/{{ name }}
6060
owner=ubuntu
6161
group=ubuntu

ansible/roles/dock_launch_config/tasks/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- app_name: "krain"
1212
- enviroment_vars: enviroment_vars
1313

14+
# this requires the use of gnu/coreutils base64 (`brew install coreutils`)
15+
# Allows us to use same base64 locally and in host
1416
- name: encode krain config to base64
1517
shell: cat ~/{{ app_name }}.conf | base64 -w 0
1618
register: krain_base64
@@ -29,7 +31,9 @@
2931
- app_name: "charon"
3032
- enviroment_vars: enviroment_vars
3133

32-
- name: encode krain config to base64
34+
# this requires the use of gnu/coreutils base64 (`brew install coreutils`)
35+
# Allows us to use same base64 locally and in host
36+
- name: encode charon config to base64
3337
shell: cat ~/{{ app_name }}.conf | base64 -w 0
3438
register: charon_base64
3539
vars:

ansible/roles/dock_launch_config/templates/init.tmpl

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
22

3-
# Set ENV files
4-
export CONSUL_PORT={{ consul_api_port }}
5-
export CONSUL_HOSTNAME={{ consul_host_address }}
6-
export VAULT_PORT={{ vault_port }}
3+
{% set has_token = ( ec2_describe_aws_access_key is defined and
4+
ec2_describe_aws_secret_key is defined and
5+
dock_registry_s3_access_key is defined and
6+
dock_registry_s3_secret_key is defined ) %}
77

8+
{% if not has_token %}
89
# Create directory for env
910
mkdir -p /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}
1011
chown ubuntu:ubuntu /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}
@@ -14,6 +15,7 @@ chmod 0711 /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}
1415
{% for item in tokens %}
1516
echo {{ item.value }} > /opt/runnable/dock-init/consul-resources/vault/{{ node_env }}/{{ item.file_name }}
1617
{% endfor %}
18+
{% endif %}
1719

1820
# Add upstart files for charon and krain
1921
mkdir -p /docker/app-logs/
@@ -34,5 +36,14 @@ start amazon-ssm-agent
3436
service krain start
3537
service charon start
3638
{% if not is_dock_pool %}
37-
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
39+
CONSUL_HOSTNAME={{ consul_host_address }} \
40+
CONSUL_PORT={{ consul_api_port }} \
41+
VAULT_PORT={{ vault_port }} \
42+
{% if has_token %}
43+
S3_ACCESS_KEY={{ dock_registry_s3_access_key }} \
44+
S3_SECRET_KEY={{ dock_registry_s3_secret_key }} \
45+
AWS_ACCESS_KEY={{ ec2_describe_aws_access_key }} \
46+
AWS_SECRET_KEY={{ ec2_describe_aws_secret_key }} \
47+
{% endif %}
48+
bash /opt/runnable/dock-init/init.sh | tee /var/log/user-script-dock-init.log
3849
{% endif %}

0 commit comments

Comments
 (0)