forked from sanguis/ansible-experiments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
omeka-plugin-handling.yml
41 lines (36 loc) · 1.15 KB
/
omeka-plugin-handling.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
# Run with: ansible-playbook -c local omeka-plugin-handling.yml
- hosts:
- local
vars:
asset:
type: "plugin"
url: "https://github.com/scholarslab/NeatlineFeatures/archive/2.0.5.zip"
file_extension: "zip"
id: "123"
asset_cache: omeka/plugins
tasks:
- name: ensure cache dir exists
file:
state: directory
path: "./{{ asset_cache }}"
- name: download plugin
get_url:
url: "{{ asset.url }}"
dest: "{{ asset_cache }}/{{ asset.id }}.{{ asset.file_extension }}"
- name: unzip plugin
shell: "unzip -o {{ asset_cache }}/{{ asset.id }}.{{ asset.file_extension }} -d {{ asset_cache }}/{{ asset.id }}"
register: unzip_result
failed_when: "unzip_result.rc > 1"
- name: find plugin file
find:
path: "{{ asset_cache }}/{{ asset.id }}/"
recurse: yes
file_type: file
patterns: '^(?:[A-Z][a-z]*)+Plugin.php$'
use_regex: yes
register: asset_find_result
- debug:
var: asset_find_result
- debug:
msg: "{{ asset_find_result.files[0].path | basename | regex_replace('^(.+)Plugin.php$', '\\1') }}"