WordPress CLI (WP-CLI) is a command-line tool used to administer your WordPress installation; we will be using it throughout the role, so the first thing our role should do is download it. To do this, we need to download the following variables in roles/wordpress/defaults/main.yml:
wp_cli: download: "https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" path: "/usr/local/bin/wp"
As you probably have gathered from the two variables, we are going to be downloading the file from wp_cli.download and copying it to wp_cli.path. The task in roles/wordpress/tasks/main.yml to do this looks like the following:
- name: download wp-cli get_url: url: "{{ wp_cli.download }}" dest: "{{ wp_cli.path }}"- name: ...