correction syntaxe master
authorrominique <romain.legoff@heureux-cyclage.org>
Fri, 10 May 2024 20:14:42 +0000 (22:14 +0200)
committerrominique <romain.legoff@heureux-cyclage.org>
Fri, 10 May 2024 20:14:42 +0000 (22:14 +0200)
correction scenario WP

creation_nouveau_site.yml
tasks/config_WP.yml
tasks/config_mariadb.yml
tasks/config_nginx.yml
tasks/config_pool_php.yml
tasks/config_www.yml
tasks/download_nextcloud_source.yml
tasks/verif_installation_nextcloud.yml
templates/nginx_WP_server.j2

index c5ca22c..145d82f 100644 (file)
       when: config_php == 'oui' or SITE == 'paheko' or SITE == 'WP' or SITE == 'nuage'
 
     - name: Inclure la configuration d'une bdd postgres
-      ansible.builtin.include_tasks: tasks/config_bdd_postgres.yml
+      ansible.builtin.include_tasks: tasks/config_postgres.yml
       when: config_bdd == 'postgres' or SITE == 'nuage'
 
     - name: Inclure la configuration d'une bdd mariadb
-      ansible.builtin.include_tasks: tasks/config_bdd_mariadb.yml
+      ansible.builtin.include_tasks: tasks/config_mariadb.yml
       when: config_bdd == 'mariadb' or SITE == 'WP'
 
     - name: Inclure la configuration nextcloud si besoin
       when: SITE == 'paheko'
 
     - name: Inclure la configuration WP si besoin
-      ansible.builtin.include_tasks: tasks/config_wp.yml
+      ansible.builtin.include_tasks: tasks/config_WP.yml
       when: SITE == 'WP'
 
     - name: Inclure le configuration du backup
 
     - name: Inclure le configuration SFTP
       ansible.builtin.include_tasks: tasks/config_sftp.yml
-      when: sftp_key =! '' and sftp_key =! 'non'
+      when: sftp_key != '' and sftp_key != 'non'
index c328bc0..235cdbb 100644 (file)
@@ -1,12 +1,12 @@
 
-- name: Create new app common folder from old version one
-  become_user: "site_{{ SIGLE }}_{{ SITE }}"
-  become: true
+- name: Copie des fichiers sources WP dans le home du nouveau site
   ansible.builtin.copy:
-    src: "/home/sites/data/wordpress"
+    src: "/home/sites/data/wordpress/"
     dest: "/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/"
     remote_src: true # because the copy is from remote host to remote host
     mode: '754' # or 'u=rwx,g=rx,o=r'
+    owner: "php_{{ SIGLE }}_{{ SITE }}"
+    group: "site_{{ SIGLE }}_{{ SITE }}"
 
 - name: Créer les fichiers spécifiques wp
   ansible.builtin.template:
index 3816d0c..831fc66 100644 (file)
@@ -1,3 +1,12 @@
+- name: Etckeeper commit if necessary
+  ansible.builtin.command: etckeeper commit "commit by ansible because installing {{ DOMAIN }}/{{ SITE }}"
+  ignore_errors: true
+
+- name: Install ansible mysql required packages
+  ansible.builtin.apt:
+    name:
+      - python3-pymysql
+
 - name: Boucle d'ajout du user php dans plusieurs groupe
   ansible.builtin.user:
     name: "php_{{ SIGLE }}_{{ SITE }}"
@@ -15,8 +24,8 @@
     encoding: utf8mb4  # pour WP
 
 - name: Créer le user mysql
-  mysql_user:
+  community.mysql.mysql_user:
     name: "php_{{ SIGLE }}_{{ SITE }}"
     priv: "php_{{ SIGLE }}_{{ SITE }}.*:ALL"
     state: present
-    login_unix_socket: /run/mysqld/mysqld.sock
\ No newline at end of file
+    login_unix_socket: /run/mysqld/mysqld.sock
index f932ac8..0c61275 100644 (file)
@@ -39,7 +39,7 @@
     owner: "root"
     group: "root"
     mode: '640' # or u=rwx,g=r,o=
-  when: SITE != 'nuage' and template_site != 'http'
+  when: SITE != 'nuage' and template_site != 'http' and SITE != 'WP'
 
 - name: Recharger le service nginx
   ansible.builtin.service:
index 970a039..cf1c432 100644 (file)
@@ -76,4 +76,4 @@
 - name: ATTENTION la config php n'a pas été créer
   ansible.builtin.debug:
     msg: "Il n'y a pas de templates php pour votre site, il faudra le créer manuellement"
-  when: SITE != 'nuage' and SITE != 'paheko' or SITE != 'WP'
+  when: SITE != 'nuage' and SITE != 'paheko' and SITE != 'WP'
index d01c9bf..c1a4b20 100644 (file)
@@ -25,6 +25,8 @@
     owner: "{{ item.owner }}"
     group: "{{ item.group }}"
     mode: "{{ item.mode }}"
+  vars: 
+    concat: "site_{{ SIGLE }}_{{ SITE }}"
   loop_control:
     label: "{{ item.path }}"
   loop:
@@ -40,6 +42,6 @@
       mode: '2751'
     - path: "/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}"
       state: directory
-      owner: 'root'
+      owner: "{{ ( SITE in ['www','WP'] ) | ternary ( concat , 'root' ) }}"
       group: "site_{{ SIGLE }}_{{ SITE }}"
       mode: '2750'
index 77a46c6..4c79f2b 100644 (file)
@@ -7,10 +7,10 @@
     mode: '755' # or u=rwx,g=rx,o=rx
     checksum: "md5:{{ nextcloud_repo_url }}/nextcloud-{{ nouvelle_version }}.tar.bz2.md5"
 
-- name: create nextcloud source dir 
+- name: Create nextcloud source dir
   become: true
   become_user: nextcloud
-  ansible.builtin.file: 
+  ansible.builtin.file:
     path: "{{ nextcloud_sources_files_path }}/nextcloud-{{ nouvelle_version }}"
     state: directory
     mode: '755' # or u=rwx,g=rx,o=rx
     src: "{{ nextcloud_sources_files_path }}/nextcloud-{{ nouvelle_version }}.tar.bz2"
     dest: "{{ nextcloud_sources_files_path }}/"
 #    mode: '755' # or u=rwx,g=rx,o=rx
-    remote_src: yes
+    remote_src: true
 
-- name: "rename nextloud dir to nextcloud-{{ nouvelle_version }}"
+- name: Rename nextloud dir to nextcloud-nouvelle_version
   become: true
   become_user: nextcloud
-  ansible.builtin.copy: 
+  ansible.builtin.copy:
     src: "{{ nextcloud_sources_files_path }}/nextcloud/"
     dest: "{{ nextcloud_sources_files_path }}/nextcloud-{{ nouvelle_version }}"
-    remote_src: yes # because the config file is already in the nextcloud_tmp_path
+    remote_src: true # because the config file is already in the nextcloud_tmp_path
 
-- name: deleted downloaded nextcloud files
+- name: Deleted downloaded nextcloud files
   become: true
   become_user: nextcloud
   ansible.builtin.file:
@@ -40,4 +40,4 @@
     state: absent
   loop:
     - "{{ nextcloud_sources_files_path }}/nextcloud-{{ nouvelle_version }}.tar.bz2"
-    - "{{ nextcloud_sources_files_path }}/nextcloud"
\ No newline at end of file
+    - "{{ nextcloud_sources_files_path }}/nextcloud"
index bb679e4..508c5fd 100644 (file)
@@ -25,4 +25,4 @@
     dest: "{{ nextcloud_common_files_path }}/nextcloud-{{ nouvelle_version }}"
     remote_src: true # because the copy is from remote host to remote host
     mode: '754' # or 'u=rwx,g=rx,o=r'
-  when: not new_nextcloud_common.stat.exists
\ No newline at end of file
+  when: not new_nextcloud_common.stat.exists
index a501e6d..a41c72d 100644 (file)
@@ -13,9 +13,9 @@ server {
     ssl_certificate_key /etc/letsencrypt/live/{{ SITE }}.{{ DOMAIN }}.{{ TLD }}/privkey.pem;
     access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k;
     error_log  /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn;
+    root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/;
+    server_name {{ DOMAIN }}.{{ TLD }} {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
 {% endif %}
-       server_name {{ DOMAIN }}.{{ TLD }} {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
-       root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/;
        index  index.php index.html index.htm;
     client_max_body_size 500M;
     location / {
@@ -36,7 +36,7 @@ server {
     }
     location ~ \.php$ {
          include snippets/fastcgi-php.conf;
-         fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
+         fastcgi_pass unix:/run/php{{ php_version }}/fpm/php_{{ SIGLE }}_{{ SITE }};
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
     }