Skip to content
An Ansible role to install or update wp-cli (WordPress Command Line)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
defaults initial import Jul 13, 2017
tasks wp-cli.phar is wp Apr 26, 2018
.editorconfig removed unused directories Jul 14, 2017
.gitignore removed unused directories Jul 14, 2017
LICENSE added meta data Jul 13, 2017


An Ansible role to install or update wp-cli.


There are no requirements in this role.

Role Variables

All variables come form the defaults directory. These can be overwiten by group_vars/all.yml. Here are the variables from this role.

  • admin_home = By default this is set to the remote servers home directory.
  • sub_dir = This variable is only used if you bin directory is elsewhere in the home directory.
  • root_bin = This variable contains the whole path to the bin directory


There are no Dependencies in this role.


This role does not have any files related.


There are no handlers in this role.


There are no templates in this role.

Example Playbook

This is the most basic way to run the wp-cli playbook:

$ ansible-playbook wp-cli.yml

This command will only run tags set with "update":

$ ansible-playbook wp-cli.yml --tags update

This command will only display the hosts and tasks that would run with playlist. The wp-cli.yml playbook will not be run:

$ ansible-playbook wp-cli.yml --list-hosts --list-tasks

To make sure wp-cli is intalled and the version. Type the following command on the servers.

wp cli info

Or use the Ansible ad-hoc command.

ansible wordpress -i hosts -m shell -a "wp cli info"

Server Commands


wp-cli is a set of command-line tools for managing wp-cli installations. You can update plugins, configure multisite installs and much more, without using a web browser.

You can’t perform that action at this time.