- block: - name: create plugin directory file: path: "{{ roundcube_dir }}/plugins/{{ plugin.name }}" state: directory owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" mode: 0775 - name: get latest version of plugin include_tasks: get_lastversion.yml vars: package: name: "{{ plugin.where }}" location: github assets: yes asset_filter: 'tar.gz$' file: "{{ roundcube_dir }}/last_pv_{{ plugin.name }}" extract: "{{ roundcube_dir }}/plugins/{{ plugin.name }}" user: "{{ roundcube_user }}" group: "{{ roundcube_group }}" strip_first_dir: yes major_branch: "{{ plugin.major | d(omit) }}" notify: restart php fpm when: plugin.where is defined - block: - name: check if subdir exists for internal plugins stat: path: "{{ roundcube_dir }}/plugins/{{ plugin.name }}" register: plugin_dir_stat - name: fail if it does not exist fail: msg: "subdir does not exist for internal plugin {{ plugin.name }}" when: not plugin_dir_stat.stat.exists or not plugin_dir_stat.stat.isdir when: plugin.where is not defined - name: template plugin config template: src: "plugin.j2" dest: "{{ roundcube_dir }}/plugins/{{ plugin.name }}/config.inc.php" force: yes mode: 0660 owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" lstrip_blocks: yes vars: config: "{{ plugin.config }}" notify: restart php fpm when: plugin.config is mapping