Managing WordPress with config files
I am lazy. That combined with the need of managing an undefined amount of WordPress installations is not a productive combination. And since I consider myself a purist therefore I don't want to rely on external services or other plugins for that. That's why I thought I could write something which uses config files. With them I can play around with Ansible to automate things. So I implemented a script called WordPress Updater.
How to use the wordpress-updater.py
The whole script is fairly easy to use. All you need to do is to define a config file and execute this script:
wordpress-updater.py --wordpress-path /var/www/wordpress --config ./wordpress.conf
The config file gives you possibilities to install plugins and themes from different sources like wp.org or any git server:
[wordpress]
version = 6.8
[plugins]
loco-translate = 2.7.2
wordpress-seo = 24.9
hello-dolly = git:https://github.com/wp-plugins/hello-dolly.git@master # this plugin is loaded from github
my-custom-plugin = custom # this plugin will be ignored but is activated
wp-super-minify = 2.0.1
[themes]
twentytwentyfive = 1.2
twentytwentyfour = 1.0
[settings]
active_theme = twentytwentyfive
In this example configuration we are installing several plugins in a defined version. The plugin "Hello Dolly" is installed from the github sources. There is also an entry for a custom plugin. This could be something self written which is not hosted somewhere else. The script will ignore updating or deleting the plugin. And because WordPress expects at least one theme active I have added a settings section to the config file which activates the desired theme.
Optional Parameters
There are two optional parameters which might help using the script:
--dry-run
— Simulate actions without performing any actual updates.--no-delete
— Doesn't delete the unmanaged plugins/themes but deactivates them
Please Note: There is no warranty. Also there is no multisite support (yet).