The last part of our WordPress installation is downloading and installing the plugins and theme files we defined in the wordpress.plugins and wordpress.theme variables.
Let's start with the tasks that install the plugins, so we don't end up rerunning the task that installs the plugins. When we need to, we will be building a little logic into the tasks. First of all, we run a task to see if all of the plugins are already installed:
- name: do we need to install the plugins? shell: "{{ wp_cli.path }} plugin is-installed {{ item }}" args: chdir: "{{ wordpress_system.home }}" become_user: "{{ wordpress_system.user }}" become: true with_items: "{{ wordpress.plugins }}" ignore_errors: yes register: wp_plugin_installed ...