aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGaƫtan <36162164+gaetanfl@users.noreply.github.com>2018-02-27 16:10:14 +0100
committerGitHub <noreply@github.com>2018-02-27 16:10:14 +0100
commita9c8a370528efa2deb93baebe4976d9667fc598e (patch)
tree5f4f4c0c14d5f59319e175ebf30866839ef01e62
parent4fdd3eb566b8b322789f74990181acc243ffb578 (diff)
parentf7fe658aeeedcec38f6fa34b063d563fb2fd51dd (diff)
downloadansible-clever-a9c8a370528efa2deb93baebe4976d9667fc598e.tar.gz
ansible-clever-a9c8a370528efa2deb93baebe4976d9667fc598e.tar.zst
ansible-clever-a9c8a370528efa2deb93baebe4976d9667fc598e.zip
Merge pull request #2 from gaetanfl/improve_cleverness
Make the role more clever friendly
-rw-r--r--.gitignore2
-rw-r--r--README.md4
-rw-r--r--defaults/main.yml3
-rw-r--r--tasks/main.yml4
-rw-r--r--templates/env.j22
-rw-r--r--vars/main.yml7
6 files changed, 16 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..323f145
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
1ansible.cfg
2*.retry
diff --git a/README.md b/README.md
index b049e6e..365a657 100644
--- a/README.md
+++ b/README.md
@@ -17,10 +17,12 @@ Variables for the application
17- `clever_token`: clever_cloud token, mandatory. 17- `clever_token`: clever_cloud token, mandatory.
18- `clever_secret`: clever_cloud secret, mandatory. 18- `clever_secret`: clever_cloud secret, mandatory.
19- `clever_app`: the id of the app to link, mandatory. 19- `clever_app`: the id of the app to link, mandatory.
20- `clever_entry_point`: the executable name to be executed by clever cloud, mandatory
20- `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional. 21- `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional.
22- `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
21- `clever_addons`: a list of dict describing addons enabled for the application from which we would use information during deploy, optional.<br/> 23- `clever_addons`: a list of dict describing addons enabled for the application from which we would use information during deploy, optional.<br/>
22 Example: `{ name: pg, env_prefix: POSTGRESQL_ADDON }` 24 Example: `{ name: pg, env_prefix: POSTGRESQL_ADDON }`
23- `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. 25- `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.
24- `domain`: the domain from which the application should be reachable, optional 26- `domain`: the domain from which the application should be reachable, optional
25- `syslog_server`: UDP Syslog server to be used as UDPSyslog drain for the application, optional. Example: `udp://198.51.100.51:12345`. 27- `syslog_server`: UDP Syslog server to be used as UDPSyslog drain for the application, optional. Example: `udp://198.51.100.51:12345`.
26 28
diff --git a/defaults/main.yml b/defaults/main.yml
index eaf3173..5271a84 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -6,7 +6,8 @@ clever_app_root: "{{ playbook_dir }}/.."
6clever_app_confdir: "{{ clever_app_root }}/.clever_cloud" 6clever_app_confdir: "{{ clever_app_root }}/.clever_cloud"
7clever_login_file: "{{ clever_app_confdir }}/login" 7clever_login_file: "{{ clever_app_confdir }}/login"
8 8
9clever_env: {} 9clever_entry_point: ""
10clever_extra_env: {}
10 11
11clever_addons: [] 12clever_addons: []
12# example 13# example
diff --git a/tasks/main.yml b/tasks/main.yml
index fa23f6c..2c9a61e 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -19,8 +19,8 @@
19 - clever-env 19 - clever-env
20 20
21- name: Include specific tasks 21- name: Include specific tasks
22 include_tasks: "{{ clever_app_tasks }}" 22 include_tasks: "{{ clever_app_tasks_file }}"
23 when: clever_app_tasks is defined 23 when: clever_app_tasks_file is defined
24 tags: 24 tags:
25 - clever 25 - clever
26 - clever-specific-role 26 - clever-specific-role
diff --git a/templates/env.j2 b/templates/env.j2
index 6010f07..d543a81 100644
--- a/templates/env.j2
+++ b/templates/env.j2
@@ -1,3 +1,3 @@
1{% for key, value in clever_env.iteritems() %} 1{% for key, value in (clever_base_env | combine(clever_env)).iteritems() %}
2{{ key }}={{ value }} 2{{ key }}={{ value }}
3{% endfor %} 3{% endfor %}
diff --git a/vars/main.yml b/vars/main.yml
index 19478fd..0b7f10a 100644
--- a/vars/main.yml
+++ b/vars/main.yml
@@ -1,2 +1,7 @@
1--- 1---
2# vars file for clever \ No newline at end of file 2# vars file for clever
3clever_base_env:
4 CACHE_DEPENDENCIES: "true"
5 CC_RUN_COMMAND: "~/.local/bin/{{ clever_entry_point }}"
6 ENABLE_METRICS: "false"
7 PORT: "8080"