--- /dev/null
+---
+language: python
+python: "2.7"
+
+# Use the new container infrastructure
+sudo: false
+
+# Install ansible
+addons:
+ apt:
+ packages:
+ - python-pip
+
+install:
+ # Install ansible
+ - pip install ansible
+
+ # Check ansible version
+ - ansible --version
+
+ # Create ansible.cfg with correct roles_path
+ - printf '[defaults]\nroles_path=../' >ansible.cfg
+
+script:
+ # Basic role syntax check
+ - ansible-playbook tests/test.yml -i tests/inventory --syntax-check
+
+notifications:
+ webhooks: https://galaxy.ansible.com/api/v1/notifications/
- `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional.
- `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_role`: role to be executed after environment and addons variables where gathered. Specific to an app, should be use to run migrations. Optional.
+- `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.
- `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`.
- name: Gather addon information for {{ addon.name }}
- shell: "clever env | grep {{ addon.env_prefix }} | sed -e 's/{{ addon.env_prefix }}_//' -e 's/=/: \"/' -e 's/$/\"/' > .clever-cloud/{{ addon.name }}_env.yml"
+ shell: "clever env | grep {{ addon.env_prefix }} | sed -e 's/{{ addon.env_prefix }}_//' -e 's/=/: \"/' -e 's/$/\"/' > {{ clever_app_confdir }}/{{ addon.name }}_env.yml"
environment:
CONFIGURATION_FILE: "{{ clever_login_file }}"
- name: Include addon var for {{ addon.name }}
include_vars:
- file: "{{ addon.name }}_env.yml"
+ file: "{{ clever_app_confdir }}/{{ addon.name }}_env.yml"
name: "{{ addon.name }}"
dest: "{{ clever_app_confdir }}/env"
no_log: true
-- name: Create add_ons variable file
+- name: Create addons variable file
include_tasks: addon.yml
vars:
addon: "{{ item }}"
- clever
- clever-env
-- name: Include specific role
- include_role: "{{ clever_app_role }}"
- when: clever_app_role
+- name: Include specific tasks
+ include_tasks: "{{ clever_app_tasks }}"
+ when: clever_app_tasks is defined
tags:
- clever
- clever-specific-role
- name: Check if clever command is available in path and version
command: clever --version
register: clever_returned_version
- ignore_error: true
+ ignore_errors: true
- name: Ensure user path exists
file:
- name: Download and install clever cli tools if necessary
unarchive:
remote_src: yes
+ extra_opts:
+ - "--strip-components=1"
src: https://clever-tools.cellar.services.clever-cloud.com/releases/{{ clever_cli_version }}/clever-tools-{{ clever_cli_version }}_linux.tar.gz
dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}"
when: clever_returned_version|failed or clever_returned_version.stdout != clever_cli_version
copy:
src: "{{ item }}"
dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}/{{ item }}"
+ mode: 0755
with_items:
- clever-set-domain.sh
- clever-set-drain.sh