- name: Etckeeper commit if necessary ansible.builtin.command: etckeeper commit "commit by ansible because installing {{ DOMAIN }}/{{ SITE }}" - name: Install required packages ansible.builtin.apt: name: - php - php-sqlite3 - php-intl - php-cli - imagemagick - php-imagick - php-mbstring - php-gnupg state: present register: php_install - name: Enable PHP modules ansible.builtin.command: phpenmod sqlite3 imagick intl when: php_install.changed - name: Bloc paheko_version when: paheko_version is undefined block: - name: Demande la version de paheko à installer ansible.builtin.pause: prompt: "Quelle version de paheko doit être utilisé" echo: true register: paheko_version_prompt - name: Definir paheko_version ansible.builtin.set_fact: paheko_version: "{{ paheko_version_prompt.user_input }}" - name: Vérif si la source paheko est téléchargée become: true ansible.builtin.stat: path: "/home/sites/data/paheko/{{ paheko_version }}" register: paheko_source_path - name: Installion de la nouvelle version paheko when: not paheko_source_path.stat.exists block: - name: Boucle création ou modifications des répertoires pahéko ansible.builtin.file: path: "{{ item.path }}" state: "{{ item.state }}" owner: "{{ item.owner }}" group: "{{ item.group }}" mode: "{{ item.mode }}" loop_control: label: "{{ item.path }}" loop: - path: "/home/sites/data/paheko/{{ paheko_version }}" state: "directory" owner: "www-data" group: "www-data" mode: "755" - name: Telecharger la source Paheko become: true become_user: www-data ansible.builtin.get_url: url: "https://fossil.kd2.org/paheko/uv/paheko-{{ paheko_version }}.tar.gz" dest: "/home/sites/data/paheko/{{ paheko_version }}.tar.gz" mode: '755' # or u=rwx,g=rx,o=rx - name: Extract downloaded paheko source become: true become_user: www-data ansible.builtin.unarchive: src: "/home/sites/data/paheko/{{ paheko_version }}.tar.gz" dest: "/home/sites/data/paheko" # mode: '755' # or u=rwx,g=rx,o=rx remote_src: true - name: Renommer paheko-version par uniquement la version become: true become_user: www-data ansible.builtin.copy: src: "/home/sites/data/paheko/paheko-{{ paheko_version }}/" dest: "/home/sites/data/paheko/{{ paheko_version }}" remote_src: true # because the config file is already on the paheko path mode: preserve - name: Deleted downloaded paheko files become: true ansible.builtin.file: path: "{{ item }}" state: absent loop: - "/home/sites/data/paheko/{{ paheko_version }}.tar.gz" - "/home/sites/data/paheko/paheko-{{ paheko_version }}" - name: Copie la source paheko vers le home du site become: true # become_user: "php_{{ SIGLE }}_{{ SITE }}" ansible.builtin.copy: src: "/home/sites/data/paheko/{{ paheko_version }}/" dest: "/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}" remote_src: true # because the config file is already in the nextcloud_tmp_path mode: '2750' - name: Modification du propriétaire group et droits du dossier ansible.builtin.file: path: "/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/" state: directory owner: "php_{{ SIGLE }}_{{ SITE }}" group: "site_{{ SIGLE }}_{{ SITE }}" mode: '2750' recurse: true # - name: Change displayed icon # ansible.builtin.copy: # src: "{{ icon }}" # dest: "/usr/share/garradin/www/admin/static/icon{{ icon | splitext | last }}" # when: icon is defined # - name: Change page favicon # ansible.builtin.copy: # src: "{{ favicon }}" # dest: "/usr/share/garradin/www/admin/static/favicon{{ icon | splitext | last }}" # when: favicon is defined - name: Recharger PHP et nginx ansible.builtin.service: name: "{{ item }}" state: reloaded loop: - "php{{ php_version }}-fpm" - "nginx"