Skip to content
Automate WordPress updating using Ansible & WP-Cli
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.


Automates the process of updating WordPress blogs in several domains/servers by using Ansible ( and WP-Cli (

I have only tried in Ubuntu. Not sure if Ansible works in Windows.

Disclaimer: You should be careful with any script you use. It is always unsafe to installa anything you have not properly reviewed.



You must have ansible installed in your system. See:

Download or clone this project

You may download it to any folder in your computer.

Create your roles/update-blogs/vars/main.yml file

wpcliuser: valid_username_in_the_server
wpcligroup: valid_group_in_the_server
wpclipath: /usr/local/bin/wp
        blog_folder: /var/www/

Modify /etc/ansible/hosts

Add a section called [blogs]:


NOTE: Only the domains in this folder will be updated.


Run it from the folder where you have your wp.yml file.

Normal usage

$ ansible-playbook wp.yml

If you want to install WP-Cli

$ ansible-playbook wp.yml --extra-vars "installcli=true" -K

NOTE: If I were you I would install this manually in your server. Just added it for very lazy people.

If you want mayor WordPress version updates

$ ansible-playbook wp.yml --extra-vars "major=true"


  • Backup all the files before updating.
  • The database backup is always using the same file. I would like to use a different file every time. And maybe download them compressed and delete the old ones.

If you do not like WP-Cli

Peter (??) created this script that does not use WP-Cli, just plain Ansible:

You can’t perform that action at this time.