-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade.yml
78 lines (64 loc) · 2.55 KB
/
upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
- name: Upgrade servers
hosts: all
become: yes
tasks:
- name: Update packages
apt: upgrade=yes update_cache=yes autoremove=yes autoclean=yes
- name: Check if composer is installed
shell: "which composer"
register: is_composer_installed
failed_when: false
- name: Update composer
command: composer selfupdate
when: is_composer_installed.rc == 0
- name: Register php version
shell: 'php -v|grep --only-matching --perl-regexp "PHP \\d+\.\\d" | cut -d" " -f 2'
register: restart_php_version
- name: Restart php fpm
service:
name: php{{ restart_php_version.stdout }}-fpm
state: restarted
when: restart_php_version.stdout != ""
- name: Start supervisor workers
command: "supervisorctl start all"
ignore_errors: true
- name: Update wp-cli
command: composer update chdir=/home/websites
become_user: '{{ wordpress_cli_user }}'
when: 'wordpress_sites is defined and wordpress_cli_user is defined'
tags: [ wordpress ]
- name: Update wordpress core
command: ../vendor/bin/wp core update chdir={{ item.path }}
become_user: '{{ item.user }}'
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]
- name: Update wordpress plugins
command: ../vendor/bin/wp plugin update --all chdir={{ item.path }}
become_user: '{{ item.user }}'
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]
- name: Update wordpress themes
command: ../vendor/bin/wp theme update --all chdir={{ item.path }}
become_user: '{{ item.user }}'
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]
- name: Update wordpress core translations
command: ../vendor/bin/wp language core update chdir={{ item.path }}
become_user: '{{ item.user }}'
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]
- name: Update wordpress plugin translations
command: ../vendor/bin/wp language plugin update --all chdir={{ item.path }}
become_user: '{{ item.user }}'
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]
- name: Update wordpress theme translations
command: ../vendor/bin/wp language theme update --all chdir={{ item.path }}
become_user: '{{ item.user }}'
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]
failed_when: false
- name: Remove unwanted wordpress file readme.html
file: path={{ item.path }}/readme.html state=absent
with_items: '{{ wordpress_sites }}'
tags: [ wordpress ]