I wrote this script based on the wp core is-installed
check. It should be simple and straightforward but it does not work, and I can’t figure out why. At first I believed the is-installed check just might not work with WP-CLI, but honestly I don’t even know enough to know where to start debugging this.
- name: Lcache Installed?
become_user: "{{ web_user }}"
command: wp plugin is-installed wp-lcache
args:
chdir: "{{ deploy_helper.new_release_path }}"
register: lcache_installed
changed_when: false
failed_when: lcache_installed.stderr == ""
- block:
- name: Run wp plugin install wp-lcache --activate
become_user: "{{ web_user }}"
command: wp plugin install wp-lcache --activate
args:
chdir: "{{ deploy_helper.new_release_path }}"
- name: Run wp lcache enable
become_user: "{{ web_user }}"
command: wp lcache enable
args:
chdir: "{{ deploy_helper.new_release_path }}"
when: lcache_installed | success