From 822b9138b11931ea2540e2dd54855947aeb2c872 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Wed, 2 Sep 2020 21:12:15 +0200 Subject: [PATCH] added initial state for rainloop --- states/rainloop/config.sls | 3 +++ states/rainloop/defaults.yaml | 11 +++++++++++ states/rainloop/init.sls | 5 +++++ states/rainloop/install.sls | 18 ++++++++++++++++++ states/rainloop/map.jinja | 5 +++++ 5 files changed, 42 insertions(+) create mode 100644 states/rainloop/config.sls create mode 100644 states/rainloop/defaults.yaml create mode 100644 states/rainloop/init.sls create mode 100644 states/rainloop/install.sls create mode 100644 states/rainloop/map.jinja diff --git a/states/rainloop/config.sls b/states/rainloop/config.sls new file mode 100644 index 0000000..140a5c8 --- /dev/null +++ b/states/rainloop/config.sls @@ -0,0 +1,3 @@ +--- +rainloop-config: + diff --git a/states/rainloop/defaults.yaml b/states/rainloop/defaults.yaml new file mode 100644 index 0000000..077e5cb --- /dev/null +++ b/states/rainloop/defaults.yaml @@ -0,0 +1,11 @@ +--- +rainloop: + enabled: true + install_dir: /usr/local/apps + release_dir: /usr/local/apps/releases + #mirror: https://github.com/RainLoop/rainloop-webmail/releases/download/v1.14.0/rainloop-community-1.14.0.zip + mirror: https://github.com/RainLoop/rainloop-webmail/releases/download + version: 1.14.0 + user: www-data + group: www-data + config: {} diff --git a/states/rainloop/init.sls b/states/rainloop/init.sls new file mode 100644 index 0000000..312f2b1 --- /dev/null +++ b/states/rainloop/init.sls @@ -0,0 +1,5 @@ +--- +include: + #- php + - .install + #- .config diff --git a/states/rainloop/install.sls b/states/rainloop/install.sls new file mode 100644 index 0000000..0cb208b --- /dev/null +++ b/states/rainloop/install.sls @@ -0,0 +1,18 @@ +--- +{%- from "rainloop/map.jinja" import rainloop with context %} +rainloop-archive-extract: + archive.extracted: + - name: {{ rainloop.release_dir }}/rainloop-community-{{ rainloop.version }} + - source: {{ rainloop.mirror }}/v{{ rainloop.version }}/rainloop-community-{{ rainloop.version }}.zip + - skip_verify: true + - enforce_toplevel: false + - user: {{ rainloop.user }} + - group: {{ rainloop.group }} + - if_missing: {{ rainloop.release_dir }}/rainloop-community-{{ rainloop.version }} + +rainloop-archive-symlink: + file.symlink: + - name: {{ rainloop.install_dir }}/rainloop + - target: {{ rainloop.release_dir }}/rainloop-community-{{ rainloop.version }} + - require: + - archive: rainloop-archive-extract diff --git a/states/rainloop/map.jinja b/states/rainloop/map.jinja new file mode 100644 index 0000000..522db3b --- /dev/null +++ b/states/rainloop/map.jinja @@ -0,0 +1,5 @@ +{%- import_yaml "rainloop/defaults.yaml" as default_settings -%} + +{%- set defaults = salt['grains.filter_by'](default_settings, default='rainloop') -%} + +{%- set rainloop = salt['pillar.get']('rainloop', default=defaults, merge=True) -%}