Skip to content

Commit

Permalink
Merge pull request #12 from ati90ati/support-env-variables
Browse files Browse the repository at this point in the history
#11 Add support for environment variables in EnvironmentFile
  • Loading branch information
orachide authored Jul 31, 2019
2 parents 64e483e + 0b29c9a commit ab16224
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
*.pytest_cache/

# Tox
.tox/
.tox/

# IntelliJ IDEA
.idea/
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Role Variables
| sb_app_healthcheck_ports | false | *None* | TCP Ports to check if the service is healthy (should be an array)|
| sb_app_service_java_home | false | *None* | Set the __JAVA_HOME__ to use |
| sb_app_stop_wait_time | false | 60 secs | The time in seconds to wait when stopping the application before forcing a shutdown |
| sb_app_env | false | array with name and value | Environment variables that will be added in the EnvironmentFile |



Expand Down Expand Up @@ -95,6 +96,11 @@ Example Playbook
- "http://localhost:8082/actuator/health"
sb_app_healthcheck_ports:
- 8082
sb_app_env:
- name: LOGGING_PATH
value: "{{ sb_applications_root_folder }}/{{ sb_app_name | upper }}/logs"
- name: SERVER_PORT
value: 8080

### Using maven artifact from maven repository

Expand All @@ -120,6 +126,11 @@ Example Playbook
- "http://localhost:8082/actuator/health"
sb_app_healthcheck_ports:
- 8082
sb_app_env:
- name: LOGGING_PATH
value: "{{ sb_applications_root_folder }}/{{ sb_app_name | upper }}/logs"
- name: SERVER_PORT
value: 8080

### Deploy multiple microservices to the same hosts

Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ sb_app_healthcheck_urls_retry_delay: 6

# HealthCheck TCP Port timeout in seconds
sb_app_healthcheck_ports_timeout: 60

sb_app_env: []
1 change: 1 addition & 0 deletions molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
sb_app_healthcheck_ports:
- 8080
- 8443
sb_app_env: []
3 changes: 3 additions & 0 deletions templates/app.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ LOG_FILENAME={{ sb_initd_log_filename }}
{% if sb_app_stop_wait_time is defined %}
STOP_WAIT_TIME={{ sb_app_stop_wait_time }}
{% endif %}
{% for item in sb_app_env %}
{{item.name}}="{{item.value | regex_replace('"', '\\"')}}"
{% endfor %}

0 comments on commit ab16224

Please sign in to comment.