aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml29
-rw-r--r--README.md2
-rw-r--r--tasks/addon.yml4
-rw-r--r--tasks/environment.yml2
-rw-r--r--tasks/main.yml6
-rw-r--r--tasks/setup.yml5
6 files changed, 40 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..49e7e1c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
1---
2language: python
3python: "2.7"
4
5# Use the new container infrastructure
6sudo: false
7
8# Install ansible
9addons:
10 apt:
11 packages:
12 - python-pip
13
14install:
15 # Install ansible
16 - pip install ansible
17
18 # Check ansible version
19 - ansible --version
20
21 # Create ansible.cfg with correct roles_path
22 - printf '[defaults]\nroles_path=../' >ansible.cfg
23
24script:
25 # Basic role syntax check
26 - ansible-playbook tests/test.yml -i tests/inventory --syntax-check
27
28notifications:
29 webhooks: https://galaxy.ansible.com/api/v1/notifications/
diff --git a/README.md b/README.md
index 2ab8663..b049e6e 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Variables for the application
20- `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional. 20- `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional.
21- `clever_addons`: a list of dict describing addons enabled for the application from which we would use information during deploy, optional.<br/> 21- `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 }` 22 Example: `{ name: pg, env_prefix: POSTGRESQL_ADDON }`
23- `clever_app_role`: role to be executed after environment and addons variables where gathered. Specific to an app, should be use to run migrations. Optional. 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.
24- `domain`: the domain from which the application should be reachable, optional 24- `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`. 25- `syslog_server`: UDP Syslog server to be used as UDPSyslog drain for the application, optional. Example: `udp://198.51.100.51:12345`.
26 26
diff --git a/tasks/addon.yml b/tasks/addon.yml
index cde7a1a..f6a4d14 100644
--- a/tasks/addon.yml
+++ b/tasks/addon.yml
@@ -1,9 +1,9 @@
1- name: Gather addon information for {{ addon.name }} 1- name: Gather addon information for {{ addon.name }}
2 shell: "clever env | grep {{ addon.env_prefix }} | sed -e 's/{{ addon.env_prefix }}_//' -e 's/=/: \"/' -e 's/$/\"/' > .clever-cloud/{{ addon.name }}_env.yml" 2 shell: "clever env | grep {{ addon.env_prefix }} | sed -e 's/{{ addon.env_prefix }}_//' -e 's/=/: \"/' -e 's/$/\"/' > {{ clever_app_confdir }}/{{ addon.name }}_env.yml"
3 environment: 3 environment:
4 CONFIGURATION_FILE: "{{ clever_login_file }}" 4 CONFIGURATION_FILE: "{{ clever_login_file }}"
5 5
6- name: Include addon var for {{ addon.name }} 6- name: Include addon var for {{ addon.name }}
7 include_vars: 7 include_vars:
8 file: "{{ addon.name }}_env.yml" 8 file: "{{ clever_app_confdir }}/{{ addon.name }}_env.yml"
9 name: "{{ addon.name }}" 9 name: "{{ addon.name }}"
diff --git a/tasks/environment.yml b/tasks/environment.yml
index 3d1ddbf..1508ad4 100644
--- a/tasks/environment.yml
+++ b/tasks/environment.yml
@@ -4,7 +4,7 @@
4 dest: "{{ clever_app_confdir }}/env" 4 dest: "{{ clever_app_confdir }}/env"
5 no_log: true 5 no_log: true
6 6
7- name: Create add_ons variable file 7- name: Create addons variable file
8 include_tasks: addon.yml 8 include_tasks: addon.yml
9 vars: 9 vars:
10 addon: "{{ item }}" 10 addon: "{{ item }}"
diff --git a/tasks/main.yml b/tasks/main.yml
index 539e591..fa23f6c 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -18,9 +18,9 @@
18 - clever 18 - clever
19 - clever-env 19 - clever-env
20 20
21- name: Include specific role 21- name: Include specific tasks
22 include_role: "{{ clever_app_role }}" 22 include_tasks: "{{ clever_app_tasks }}"
23 when: clever_app_role 23 when: clever_app_tasks is defined
24 tags: 24 tags:
25 - clever 25 - clever
26 - clever-specific-role 26 - clever-specific-role
diff --git a/tasks/setup.yml b/tasks/setup.yml
index 49e91ca..ac9fdcb 100644
--- a/tasks/setup.yml
+++ b/tasks/setup.yml
@@ -1,7 +1,7 @@
1- name: Check if clever command is available in path and version 1- name: Check if clever command is available in path and version
2 command: clever --version 2 command: clever --version
3 register: clever_returned_version 3 register: clever_returned_version
4 ignore_error: true 4 ignore_errors: true
5 5
6- name: Ensure user path exists 6- name: Ensure user path exists
7 file: 7 file:
@@ -11,6 +11,8 @@
11- name: Download and install clever cli tools if necessary 11- name: Download and install clever cli tools if necessary
12 unarchive: 12 unarchive:
13 remote_src: yes 13 remote_src: yes
14 extra_opts:
15 - "--strip-components=1"
14 src: https://clever-tools.cellar.services.clever-cloud.com/releases/{{ clever_cli_version }}/clever-tools-{{ clever_cli_version }}_linux.tar.gz 16 src: https://clever-tools.cellar.services.clever-cloud.com/releases/{{ clever_cli_version }}/clever-tools-{{ clever_cli_version }}_linux.tar.gz
15 dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}" 17 dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}"
16 when: clever_returned_version|failed or clever_returned_version.stdout != clever_cli_version 18 when: clever_returned_version|failed or clever_returned_version.stdout != clever_cli_version
@@ -19,6 +21,7 @@
19 copy: 21 copy:
20 src: "{{ item }}" 22 src: "{{ item }}"
21 dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}/{{ item }}" 23 dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}/{{ item }}"
24 mode: 0755
22 with_items: 25 with_items:
23 - clever-set-domain.sh 26 - clever-set-domain.sh
24 - clever-set-drain.sh 27 - clever-set-drain.sh