1 - name: Etckeeper commit if necessary
2 ansible.builtin.command: etckeeper commit "commit by ansible because installing {{ DOMAIN }}/{{ SITE }}"
4 - name: Install required packages
17 - name: Enable PHP modules
18 ansible.builtin.command: phpenmod sqlite3 imagick intl
19 when: php_install.changed
21 - name: Ajout de l'utilisateur php_SIGLE_SITE
23 name: "php_{{ SIGLE }}_{{ SITE }}"
24 home: "/etc/php/{{ php_version }}/fpm/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}"
30 # group: "php_{{ SIGLE }}_{{ SITE }}"
32 - name: Bloc paheko_version
33 when: paheko_version is undefined
35 - name: Demande la version de paheko à installer
36 ansible.builtin.pause:
37 prompt: "Quelle version de paheko doit être utilisé"
39 register: paheko_version_prompt
41 - name: Definir paheko_version
42 ansible.builtin.set_fact:
43 paheko_version: "{{ paheko_version_prompt.user_input }}"
45 - name: Vérif si la source paheko est téléchargée
48 path: "/home/sites/data/paheko/{{ paheko_version }}"
49 register: paheko_source_path
51 - name: Installion de la nouvelle version paheko
52 when: not paheko_source_path.stat.exists
55 - name: Boucle création ou modifications des répertoires pahéko
57 path: "{{ item.path }}"
58 state: "{{ item.state }}"
59 owner: "{{ item.owner }}"
60 group: "{{ item.group }}"
61 mode: "{{ item.mode }}"
63 label: "{{ item.path }}"
65 - path: "/home/sites/data/paheko/{{ paheko_version }}"
71 - name: Telecharger la source Paheko
74 ansible.builtin.get_url:
75 url: "https://fossil.kd2.org/paheko/uv/paheko-{{ paheko_version }}.tar.gz"
76 dest: "/home/sites/data/paheko/{{ paheko_version }}.tar.gz"
77 mode: '755' # or u=rwx,g=rx,o=rx
79 - name: Extract downloaded paheko source
82 ansible.builtin.unarchive:
83 src: "/home/sites/data/paheko/{{ paheko_version }}.tar.gz"
84 dest: "/home/sites/data/paheko"
85 # mode: '755' # or u=rwx,g=rx,o=rx
88 - name: Renommer paheko-version par uniquement la version
92 src: "/home/sites/data/paheko/paheko-{{ paheko_version }}/"
93 dest: "/home/sites/data/paheko/{{ paheko_version }}"
94 remote_src: true # because the config file is already on the paheko path
97 - name: Deleted downloaded paheko files
103 - "/home/sites/data/paheko/{{ paheko_version }}.tar.gz"
104 - "/home/sites/data/paheko/paheko-{{ paheko_version }}"
106 - name: Copie la source paheko vers le home du site
108 # become_user: "php_{{ SIGLE }}_{{ SITE }}"
109 ansible.builtin.copy:
110 src: "/home/sites/data/paheko/{{ paheko_version }}/"
111 dest: "/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}"
112 remote_src: true # because the config file is already in the nextcloud_tmp_path
114 - name: Modification du propriétaire group et droits du dossier
115 ansible.builtin.file:
116 path: "/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/"
118 owner: "php_{{ SIGLE }}_{{ SITE }}"
119 group: "site_{{ SIGLE }}_{{ SITE }}"
123 - name: Boucle d'ajout du user php dans plusieurs groupe
124 ansible.builtin.user:
125 name: "php_{{ SIGLE }}_{{ SITE }}"
129 - "site_{{ SIGLE }}_{{ SITE }}"
131 # - name: Change displayed icon
132 # ansible.builtin.copy:
134 # dest: "/usr/share/garradin/www/admin/static/icon{{ icon | splitext | last }}"
135 # when: icon is defined
137 # - name: Change page favicon
138 # ansible.builtin.copy:
139 # src: "{{ favicon }}"
140 # dest: "/usr/share/garradin/www/admin/static/favicon{{ icon | splitext | last }}"
141 # when: favicon is defined
143 - name: Recharger PHP et nginx
144 ansible.builtin.service:
148 - "php{{ php_version }}-fpm"