]> git.immae.eu Git - github/fretlink/ansible-clever.git/commitdiff
define safe default variable for clever and rename clever_app_tasks to clever_app_tas... 2/head
authorGaëtan Duchaussois <gaetan.duchaussois@fretlink.com>
Mon, 26 Feb 2018 09:54:37 +0000 (10:54 +0100)
committerGaëtan Duchaussois <gaetan.duchaussois@fretlink.com>
Mon, 26 Feb 2018 11:01:10 +0000 (12:01 +0100)
.gitignore [new file with mode: 0644]
README.md
defaults/main.yml
tasks/main.yml
templates/env.j2
vars/main.yml

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..323f145
--- /dev/null
@@ -0,0 +1,2 @@
+ansible.cfg
+*.retry
index b049e6e3470b1d4f02fa158e1b4849cb850de26f..365a657f5fcd8f7e37f35daef7f562887a827eba 100644 (file)
--- a/README.md
+++ b/README.md
@@ -17,10 +17,12 @@ Variables for the application
 - `clever_token`: clever_cloud token, mandatory.
 - `clever_secret`: clever_cloud secret, mandatory.
 - `clever_app`: the id of the app to link, mandatory.
+- `clever_entry_point`: the executable name to be executed by clever cloud, mandatory
 - `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional.
+- `clever_base_env`: a dict set in vars/main.yml with safe default and mandatory variables for an app to be run on clever. ` clever_base_env | combine(clever_env)` is passed to `clever env` command
 - `clever_addons`: a list of dict describing addons enabled for the application from which we would use information during deploy, optional.<br/>
   Example: `{ name: pg, env_prefix: POSTGRESQL_ADDON }`
-- `clever_app_tasks`: tasks file to be executed after environment and addons variables where gathered. Specific to an app, should be use to run migrations. Optional.
+- `clever_app_tasks_file`: tasks file to be executed after environment and addons variables where gathered. Specific to an app, should be use to run migrations. Optional.
 - `domain`: the domain from which the application should be reachable, optional
 - `syslog_server`: UDP Syslog server to be used as UDPSyslog drain for the application, optional. Example: `udp://198.51.100.51:12345`.
 
index eaf31737e75f67117afd3dbc38bd0c89240d8989..5271a845d692382e373b84ecaf7afdb849b75130 100644 (file)
@@ -6,7 +6,8 @@ clever_app_root: "{{ playbook_dir }}/.."
 clever_app_confdir: "{{ clever_app_root }}/.clever_cloud"
 clever_login_file: "{{ clever_app_confdir }}/login"
 
-clever_env: {}
+clever_entry_point: ""
+clever_extra_env: {}
 
 clever_addons: []
 # example
index fa23f6c79aa55da219413f9f316ca9d12bbfe8c9..2c9a61edb030ac1c6316038bd7a7bbb3b4610056 100644 (file)
@@ -19,8 +19,8 @@
     - clever-env
 
 - name: Include specific tasks
-  include_tasks: "{{ clever_app_tasks }}"
-  when: clever_app_tasks is defined
+  include_tasks: "{{ clever_app_tasks_file }}"
+  when: clever_app_tasks_file is defined
   tags:
     - clever
     - clever-specific-role
index 6010f07fdaf560d65cdd6e5a748e0d1294372425..d543a81b769b7511db622408ed85a11caf49bebd 100644 (file)
@@ -1,3 +1,3 @@
-{% for key, value in clever_env.iteritems() %}
+{% for key, value in (clever_base_env | combine(clever_env)).iteritems() %}
 {{ key }}={{ value }}
 {% endfor %}
index 19478fdce6ecbdb103eab73ba1f5046d744f19f5..0b7f10af1fda3b6f7e6745190412dfcd760f79a3 100644 (file)
@@ -1,2 +1,7 @@
 ---
-# vars file for clever
\ No newline at end of file
+# vars file for clever
+clever_base_env:
+  CACHE_DEPENDENCIES: "true"
+  CC_RUN_COMMAND:     "~/.local/bin/{{ clever_entry_point }}"
+  ENABLE_METRICS:     "false"
+  PORT:               "8080"