correction de config_postgres
[lhc/ansible.git] / tasks / config_nuage.yml
index 06652ce..0f03c5c 100644 (file)
@@ -1,5 +1,5 @@
 - name: Etckeeper commit if necessary
-  ansible.builtin.command: etckeeper commit "commit by ansible because installing {{ DOMAIN }}/{{ SITE }}"
+  ansible.builtin.command: etckeeper commit "commit by ansible because installing {{ DOMAIN }}/{{ config_ss_domain }}"
   ignore_errors: true
 
 - name: Install required packages
       - php-gmp
 #      - php-exif
       - php-redis
+      - imagemagick
       - php-imagick
       - python3-psycopg2 # module ansible psql
     state: present
 
 - name: Boucle d'ajout du user php dans plusieurs groupe
   ansible.builtin.user:
-    name: "php_{{ SIGLE }}_{{ SITE }}"
+    name: "php_{{ SIGLE }}_{{ config_ss_domain }}"
     groups: "{{ item }}"
     append: true
   loop:
     - nextcloud
     - postgres-data
     - redis
-    - "site_{{ SIGLE }}_{{ SITE }}"
+    - "site_{{ SIGLE }}_{{ config_ss_domain }}"
 
 - name: Bloc nouvelle version nextcloud
   when: nouvelle_version is undefined
 - name: Inclure la verif de l'install nextcloud
   ansible.builtin.include_tasks: tasks/verif_installation_nextcloud.yml
 
-- name: PostgreSQL - nextcloud_php_user role is created
-  become_user: postgres
-  become: true
-  community.postgresql.postgresql_user:
-    name: "{{ nextcloud_php_user }}"
-    state: present
-    role_attr_flags: CREATEDB
-
-- name: PostgreSQL -  nextcloud_db_name  database is created
-  become_user: postgres
-  become: true
-  community.postgresql.postgresql_db:
-    name: "{{ nextcloud_db_name }}"
-    state: "{{ item }}"
-    owner: "{{ nextcloud_php_user }}"
-  loop:
-    - absent
-    - present
-
 - name: Pour chaque base, ajouter les droits suivants à l'utilisateur php
   become_user: postgres
   become: true
       grant_option: true
       name: "GRANT ALL ON SCHEMA public TO php_{{ SIGLE }}_nuage WITH GRANT OPTION;"
 
-- name: Autoriser l'utilisateur php à se connecter à la bdd nextcloud
-  community.postgresql.postgresql_pg_hba:
-    dest: "/etc/postgresql/{{ postgres_version }}/main/pg_hba.conf"
-    contype: local
-    users: "php_{{ SIGLE }}_{{ SITE }}"
-    databases: "php_{{ SIGLE }}_{{ SITE }}"
-    method: peer
-    keep_comments_at_rules: true
-    comment: "autoriser le user php_{{ SIGLE }}_{{ SITE }} à se connecter à la bdd du meme nom"
-
 - name: Boucle création des répertoires app, config et data nextcloud
   ansible.builtin.file:
     path: "{{ item.path }}"
 
 - name: Create nextcloud common app dir symbolic link
   ansible.builtin.file:
-    src: "{{ nextcloud_symbolic_common }}"
+    src: "{{ nextcloud_common }}"
     dest: "{{ nextcloud_webroot }}/common"
     owner: nextcloud
     group: nextcloud
       group: "{{ nextcloud_websrv_user }}"
       mode: '640'
 
-- name: Recharger plusieurs services
+- name: Recharger php
   ansible.builtin.service:
     name: "{{ item }}"
     state: reloaded
   loop:
-    - "postgresql"
     - "php{{ php_version }}-fpm"
 
 - name: Lancement du script d'installation nextcloud # noqa : command-instead-of-module
   ansible.builtin.command: >
           ./console maintenance:install
           --database='pgsql'
-          --database-name="php_{{ SIGLE }}_{{ SITE }}"
-          --database-user="php_{{ SIGLE }}_{{ SITE }}"
+          --database-name="php_{{ SIGLE }}_{{ config_ss_domain }}"
+          --database-user="php_{{ SIGLE }}_{{ config_ss_domain }}"
           --database-host="/var/run/postgresql/"
           --database-pass=""
           --admin-user='admin'
           --admin-pass='ckoideja'
-          --data-dir="/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/data/"
+          --data-dir="/home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/data/"
   args:
     chdir: "{{ nextcloud_webroot }}"
   register: install_result
       group: "{{ nextcloud_websrv_user }}"
       mode: '640'
 
-- name: Creation d'un lien symbolique vers le configuration nextcloud commun
+- name: Creation d'un lien symbolique vers la configuration nextcloud common
   ansible.builtin.file:
     src: "../../../../nextcloud/common.config.php"
     path: "{{ nextcloud_webroot }}/config/common.config.php"
 
 - name: Creation d'un fichier cron pour /etc/cron.d
   ansible.builtin.cron:
-    name: "nextcloud {{ SIGLE }}_{{ SITE }} taches d'arriere plan toutes les 5 mins"
+    name: "nextcloud {{ SIGLE }}_{{ config_ss_domain }} taches d'arriere plan toutes les 5 mins"
     minute: "*/5"
-    user: "php_{{ SIGLE }}_{{ SITE }}"
+    user: "php_{{ SIGLE }}_{{ config_ss_domain }}"
     job: "{{ nextcloud_webroot }}/cron"
 
 - name: Recharger plusieurs services