correction syntaxe
[lhc/ansible.git] / tasks / update_nextcloud.yml
1 - name: Active le mode maintenance # noqa : command-instead-of-module
2 become_user: "{{ nextcloud_php_user }}"
3 become: true
4 ansible.builtin.command: './console maintenance:mode --on'
5 args:
6 chdir: "{{ nextcloud_webroot }}"
7
8 - name: Update nextcloud root dir symbolic link
9 become: true
10 ansible.builtin.file:
11 src: "{{ nextcloud_source }}"
12 dest: "{{ nextcloud_webroot }}/nextcloud"
13 owner: nextcloud
14 group: nextcloud
15 state: link
16 follow: false
17
18 - name: Update nextcloud common app dir symbolic link
19 become: true
20 ansible.builtin.file:
21 src: "{{ nextcloud_common }}"
22 dest: "{{ nextcloud_webroot }}/common"
23 owner: nextcloud
24 group: nextcloud
25 state: link
26 follow: false
27
28 - name: Desactive le mode maintenance # noqa : command-instead-of-module
29 become_user: "{{ nextcloud_php_user }}"
30 become: true
31 ansible.builtin.command: './console maintenance:mode --off'
32 args:
33 chdir: "{{ nextcloud_webroot }}"
34
35 - name: Run nextcloud upgrade script # noqa : command-instead-of-module
36 become_user: "{{ nextcloud_php_user }}"
37 become: true
38 ansible.builtin.command: ./console upgrade
39 args:
40 chdir: "{{ nextcloud_webroot }}"
41 register: nc_upgrade_result
42
43 - name: Display upgrade result
44 debug:
45 var: nc_upgrade_result.stdout_lines
46
47 - name: Bloc de tâches contrôlant la fin de la maintenance de mise à jour
48 block:
49 - name: Wait for nextcloud maintenance mode to become false # noqa : command-instead-of-module
50 become_user: "{{ nextcloud_php_user }}"
51 become: true
52 ansible.builtin.command: ./console status
53 args:
54 chdir: "{{ nextcloud_webroot }}"
55 register: result
56 until: "'maintenance: false' in result.stdout"
57 retries: 15
58 delay: 20
59 rescue:
60 - name: Deactivate maintenance mode manually # noqa : command-instead-of-module
61 become_user: "{{ nextcloud_php_user }}"
62 become: true
63 ansible.builtin.command: ./console maintenance:mode --off
64 args:
65 chdir: "{{ nextcloud_webroot }}"
66 register: rescue
67
68 - name: Display rescue
69 ansible.builtin.debug:
70 var: rescue.stdout_lines
71
72 - name: Lancement de commande de maintenance # noqa : command-instead-of-module
73 become_user: "{{ nextcloud_php_user }}"
74 become: true
75 ansible.builtin.command: "./console {{ command }}"
76 args:
77 chdir: "{{ nextcloud_webroot }}"
78 loop:
79 - db:add-missing-columns
80 - db:add-missing-indices
81 - db:add-missing-primary-keys
82 loop_control:
83 loop_var: command
84 register: nc_indices_cmd
85
86 - name: Display each occ commands result
87 ansible.builtin.debug:
88 msg: "{{ item.stdout_lines }}"
89 loop: "{{ nc_indices_cmd.results }}"
90 loop_control:
91 label: "{{ item.command }}"
92
93 - name: Reload php fpm service
94 become: true
95 ansible.builtin.service:
96 name: "{{ php_fpm_service }}"
97 state: reloaded