Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
# tasks file for wordpress, plugins
---
- name: plugins | identify installation
  command: >
    wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin is-installed {{ item.1.name }}
  register: _check_installation_plugins
  failed_when: false
  changed_when: false
  with_subelements:
    - "{{ wordpress_installs }}"
    - plugins
  when: item.1
  tags:
    - wordpress-plugins-is-installed-plugin

- name: plugins | install | wordpress.org
  command: >
    wp-cli --allow-root --no-color --path='{{ item.item.0.path }}'
    {{ '--force' if item.item.1.force | default(false) else '' }} plugin install {{ item.item.1.name }}
  with_items: "{{ _check_installation_plugins.results | default([]) }}"
  when: >
    item.item.1.name
    and item.item.1.zip | default('') == ''
    and item.item.1.url | default('') == ''
    and item.rc != 0
  tags:
    - wordpress-plugins-install-plugin
    - wordpress-plugins-install-plugin-wordpress_org

- name: plugins | install | zip | copy
  copy:
    src: "{{ item.item.1.zip }}"
    dest: "{{ wordpress_data_path }}/plugins/{{ item.item.1.name }}.zip"
    owner: root
    group: root
    mode: 0644
  with_items: "{{ _check_installation_plugins.results | default([]) }}"
  when: >
    item.item.1.name
    and item.item.1.zip | default('') != ''
    and item.item.1.url | default('') == ''
    and item.rc != 0
  tags:
    - wordpress-plugins-install-plugin
    - wordpress-plugins-install-plugin-zip
    - wordpress-plugins-install-plugin-zip-copy

- name: plugins | install | zip | install
  command: >
    wp-cli --allow-root --no-color --path='{{ item.item.0.path }}'
    {{ '--force' if item.item.1.force | default(false) else '' }} plugin install {{ wordpress_data_path }}/plugins/{{ item.item.1.name }}.zip
  with_items: "{{ _check_installation_plugins.results | default([]) }}"
  when: >
    item.item.1.name
    and item.item.1.zip | default('') != ''
    and item.item.1.url | default('') == ''
    and item.rc != 0
  tags:
    - wordpress-plugins-install-plugin
    - wordpress-plugins-install-plugin-zip
    - wordpress-plugins-install-plugin-zip-install

- name: plugins | install | url
  command: >
    wp-cli --allow-root --no-color --path='{{ item.item.0.path }}'
    {{ '--force' if item.item.1.force | default(false) else '' }} plugin install {{ item.item.1.url }}
  with_items: "{{ _check_installation_plugins.results | default([]) }}"
  when: >
    item.item.1.name
    and item.item.1.zip | default('') == ''
    and item.item.1.url | default('') != ''
    and item.rc != 0
  tags:
    - wordpress-plugins-install-plugin
    - wordpress-plugins-install-plugin-url

- name: plugins | check install
  command: >
    wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin is-installed {{ item.1.name }}
  changed_when: false
  with_subelements:
    - "{{ wordpress_installs }}"
    - plugins
  when: item.1.name
  tags:
    - wordpress-plugins-check-install-plugin

- name: plugins | activate
  command: >
    wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin activate {{ item.1.name }}
  register: _check_activate_plugin
  changed_when: "'Success: Plugin' in _check_activate_plugin.stdout and not 'already' in _check_activate_plugin.stdout"
  with_subelements:
    - "{{ wordpress_installs }}"
    - plugins
  when: item.1.name and item.1.activate | default(true)
  tags:
    - wordpress-plugins-activate-plugin

- name: plugins | deactivate
  command: >
    wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin deactivate {{ item.1.name }}
  register: _check_deactivate_plugin
  changed_when: "'Success: Plugin' in _check_deactivate_plugin.stdout and not 'already' in _check_deactivate_plugin.stdout"
  with_subelements:
    - "{{ wordpress_installs }}"
    - plugins
  when: item.1.name and not item.1.activate | default(true)
  tags:
    - wordpress-plugins-deactivate-plugin