47 lines
1.6 KiB
YAML
47 lines
1.6 KiB
YAML
---
|
|
- block:
|
|
- name: Create a directory to store the logs of the wp maintenance commands
|
|
file: dest=/var/log/wordpress_maintenance state=directory owner={{ wordpress_system_user }} mode=0755
|
|
tags: wordpress
|
|
|
|
- block:
|
|
- name: Update thw WP core.
|
|
command: wp core update {% if wordpress_auto_upgrade_minor_only %} --minor{% endif %}
|
|
args:
|
|
chdir: '{{ wordpress_doc_root }}'
|
|
when: wordpress_auto_upgrade | bool
|
|
|
|
- name: Cron job that updates the Wordpress core
|
|
cron:
|
|
name: "Update the Wordpress core"
|
|
special_time: 'daily'
|
|
job: "cd {{ wordpress_doc_root }} && /usr/local/bin/wp core update {% if wordpress_auto_upgrade_minor_only %} --minor{% endif %} > /var/log/wordpress_maintenance/wp_core_update.log 2>&1"
|
|
state: present
|
|
user: '{{ wordpress_system_user }}'
|
|
|
|
- name: Upgrade all the plugins
|
|
command: wp plugin update --all
|
|
args:
|
|
chdir: '{{ wordpress_doc_root }}'
|
|
when: wordpress_auto_upgrade_all_plugins | bool
|
|
|
|
- name: Upgrade a list of plugins
|
|
command: wp plugin update {{ item }}
|
|
args:
|
|
chdir: '{{ wordpress_doc_root }}'
|
|
with_items: '{{ wordpress_plugins_upgrade_list }}'
|
|
when: wordpress_plugins_upgrade_list is defined
|
|
|
|
- name: Cron job that updates the Wordpress plugins
|
|
cron:
|
|
name: "Update the Wordpress plugins"
|
|
special_time: 'daily'
|
|
job: "cd {{ wordpress_doc_root }} && /usr/local/bin/wp plugin update --all > /var/log/wordpress_maintenance/wp_plugins_update.log 2>&1"
|
|
state: present
|
|
user: '{{ wordpress_system_user }}'
|
|
|
|
become: True
|
|
become_user: '{{ wordpress_system_user }}'
|
|
tags: wordpress
|
|
|