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