Skip to content

Commit

Permalink
add some parameters and defaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
orachide committed Jul 21, 2018
1 parent 558fd41 commit 5fe8bae
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ Role Variables
| sb_app_java_opts_xms | false | *256M* | JAVA XMS value |
| sb_app_java_opts_xmx | false | *1024M* | JAVA XMX value |
| sb_app_java_opts_others | false | *None* | Custom JAVA_OPTS options |
| sb_app_config_file_template_path | false | *None* | Spring appilcation.yml file template path. This file will be copy near to the artifact |
| sb_app_config_file_template_path | false | *None* | Spring application.yml file template path. This file will be copy near to the artifact |
| sb_app_config_file_final_name | false | **application.yml** | Configuration file final name, could be *.yml or *.properties |
| sb_app_logback_file_template_path | false | *None* | Logback file template path. This file will be loaded by setting `logging.config` system property |
| sb_app_healthcheck_urls | false | *None* | Http urls to check if the service is healthy (should be an array)|
| 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 |



Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ sb_app_extension: jar
sb_maven_repository_url: http://repo1.maven.org/maven2
sb_applications_root_folder: /opt/applis
sb_app_as_a_service: true
sb_app_stop_wait_time: 60
# download maven artifact on ansible host
sb_local_maven_artifact_dowload: true
sb_local_maven_artifact_download_temp_folder: /tmp
sb_app_java_opts_xms: 256M
sb_app_java_opts_xmx: 1024M
sb_app_config_file_final_name: application.yml

# initd conf
sb_initd_pid_folder: "{{ sb_applications_root_folder }}/{{ sb_app_name | upper }}/run"
Expand Down
5 changes: 4 additions & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
roles:
- role: ansible-role-springboot
# sb_app_state: absent
# sb_app_stop_wait_time: 30
sb_app_name: simple-springboot-app
sb_app_as_a_service: true
sb_app_group_id: fr.runadium
sb_app_artifact_id: simple-springboot-app
sb_app_version: 0.0.1-SNAPSHOT
Expand All @@ -21,8 +23,9 @@
sb_app_artifact_file: "{{ playbook_dir}}/artifacts/simple-springboot-app-0.0.1-SNAPSHOT.jar"
# sb_app_service_debug: true
sb_app_config_file_template_path: "{{ playbook_dir }}/templates/simple-springboot-app-configuration.yml.j2"
sb_app_config_file_final_name: application.yml
sb_app_logback_file_template_path: "{{ playbook_dir }}/templates/logback.xml.j2"
sb_app_java_opts_others: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6006"
sb_app_java_opts_others: "-Djavax.net.debug=all -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6006"
sb_app_healthcheck_urls:
- "https://localhost:8443/actuator/health"
- "http://localhost:8080/actuator/health"
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/templates/logback.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="org.springframework.controllers" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</logger>
<logger name="org.springframework.web" level="DEBUG" additivity="false">
<appender-ref ref="FILE"/>
Expand Down
9 changes: 5 additions & 4 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
when: not use_system_d
with_items:
- run
- logs

- debug: var=sb_app_artifact_file verbosity=1

Expand Down Expand Up @@ -102,7 +103,7 @@
template:
src: app.conf.j2
dest: "{{ sb_app_artifact_destination_folder }}/{{ sb_app_name }}-{{ sb_app_version }}.conf"
mode: 0644
mode: 0400
owner: "{{ sb_app_user }}"
group: "{{ sb_app_user_group }}"
notify:
Expand All @@ -123,7 +124,7 @@
- name: "Install | Source application configuration file"
template:
src: "{{ sb_app_config_file_template_path }}"
dest: "{{ sb_app_artifact_destination_folder }}/application.yml"
dest: "{{ sb_app_artifact_destination_folder }}/{{ sb_app_config_file_final_name }}"
mode: 0644
owner: "{{ sb_app_user }}"
group: "{{ sb_app_user_group }}"
Expand All @@ -134,8 +135,8 @@

- name: "Install | Ensure application configuration symlink exist"
file:
src: "{{ sb_app_artifact_destination_folder }}/application.yml"
dest: "{{ sb_applications_root_folder }}/{{ sb_app_name | upper }}/application.yml"
src: "{{ sb_app_artifact_destination_folder }}/{{ sb_app_config_file_final_name }}"
dest: "{{ sb_applications_root_folder }}/{{ sb_app_name | upper }}/{{ sb_app_config_file_final_name }}"
state: link
owner: "{{ sb_app_user }}"
group: "{{ sb_app_user_group }}"
Expand Down
3 changes: 3 additions & 0 deletions templates/app.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ RUN_ARGS={{ sb_app_run_args }}
PID_FOLDER={{ sb_initd_pid_folder }}
LOG_FOLDER={{ sb_initd_log_folder }}
LOG_FILENAME={{ sb_initd_log_filename }}
{% if sb_app_stop_wait_time is defined %}
STOP_WAIT_TIME={{ sb_app_stop_wait_time }}
{% endif %}

0 comments on commit 5fe8bae

Please sign in to comment.