From 7f4a8c29bd240b0b37c9980817bf02dcfca6e003 Mon Sep 17 00:00:00 2001 From: rominique Date: Thu, 4 Jul 2024 17:09:23 +0200 Subject: [PATCH] correction dans les option par defaut des promps --- tasks/config_nuage.yml | 8 ++--- tasks/config_options_www.yml | 50 +++++++++++++------------- tasks/config_pool_php.yml | 4 +-- tasks/verif_installation_nextcloud.yml | 7 ++-- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/tasks/config_nuage.yml b/tasks/config_nuage.yml index 0f03c5c..bf99c5b 100644 --- a/tasks/config_nuage.yml +++ b/tasks/config_nuage.yml @@ -51,26 +51,26 @@ block: - name: Demande la version de nextcloud à installer ansible.builtin.pause: - prompt: "Quelle version de nextcloud doit être utilisée" + prompt: "Quelle version de nextcloud doit être utilisée? (default: 27.1.9)" echo: true register: nextcloud_version_prompt - name: Definir nouvelle_version ansible.builtin.set_fact: - nouvelle_version: "{{ nextcloud_version_prompt.user_input }}" + nouvelle_version: "{{ ( nextcloud_version_prompt.user_input | length == 0 ) | ternary ('27.1.9', nextcloud_version_prompt.user_input) }}" - name: Bloc ancienne version nextcloud when: ancienne_version is undefined block: - name: Demande la version de nextcloud déjà installée ansible.builtin.pause: - prompt: "Quelle version de nextcloud déjà installée" + prompt: "Quelle version de nextcloud déjà installée? (default: 26.0.4)" echo: true register: ancienne_version_prompt - name: Definir ancienne_version ansible.builtin.set_fact: - ancienne_version: "{{ ancienne_version_prompt.user_input }}" + ancienne_version: "{{ ( ancienne_version_prompt.user_input | length == 0 ) | ternary ('26.0.4', ancienne_version_prompt.user_input) }}" - name: Inclure la verif de l'install nextcloud ansible.builtin.include_tasks: tasks/verif_installation_nextcloud.yml diff --git a/tasks/config_options_www.yml b/tasks/config_options_www.yml index 93fdb51..4f46142 100644 --- a/tasks/config_options_www.yml +++ b/tasks/config_options_www.yml @@ -1,47 +1,47 @@ -- name: Bloc demande sous-domaine +- name: Demande sous-domaine tags: https - block: - - - name: Demande sous-domaine - ansible.builtin.pause: - prompt: 'quel sous-domaine faut-il configurer?(ex: www/gestion)' - echo: true - register: config_ss_domain_promp - - - name: Definir config_ss_domain - ansible.builtin.set_fact: - config_ss_domain: "{{ config_ss_domain_promp.user_input | default(SITE) }}" + ansible.builtin.pause: + prompt: 'quel sous-domaine faut-il configurer?(ex: www/gestion)' + echo: true + default: '{{ SITE }}' + register: config_ss_domain_promp + when: SITE != 'nuage' - name: Bloc demande des autres options - when: SITE != 'paheko' or SITE != 'nuage' # and SITE != 'WP' + when: SITE != 'paheko' and SITE != 'nuage' and SITE != 'WP' block: - name: Demande php ansible.builtin.pause: - prompt: 'Faut-il configurer un pool PHP?(ex: oui/non)' + prompt: 'Faut-il configurer un pool PHP?(oui/non)' echo: true register: config_php_promp - - name: Definir config_php - ansible.builtin.set_fact: - config_php: "{{ config_php_promp.user_input | default('non') }}" - - name: Demande bdd ansible.builtin.pause: prompt: 'Faut-il configurer une base de données SQL?(ex: mariadb/postgres/non)' echo: true register: config_bdd_promp - - name: Definir config_bdd - ansible.builtin.set_fact: - config_bdd: "{{ config_bdd_promp.user_input | default('non') }}" - - name: Demande sftp_key ansible.builtin.pause: prompt: 'besoin de configurer un accès SFTP pour ce compte (vide ou clé public)' echo: true register: sftp_key_promp - - name: Definir sftp_key - ansible.builtin.set_fact: - sftp_key: "{{ sftp_key_promp.user_input | default('non') }}" +- name: Definir config_php + ansible.builtin.set_fact: + config_php: "{{ ( config_php_promp.user_input | default ('') | length == 0 ) | ternary ('non', config_php_promp.user_input) }}" + +- name: Definir config_ss_domain + tags: https + ansible.builtin.set_fact: + config_ss_domain: "{{ ( SITE == 'nuage' | default ('') ) | ternary (SITE, config_ss_domain_promp.user_input) }}" + +- name: Definir config_bdd + ansible.builtin.set_fact: + config_bdd: "{{ ( config_bdd_promp.user_input | default ('') | length == 0 ) | ternary ('non', config_bdd_promp.user_input) }}" + +- name: Definir sftp_key + ansible.builtin.set_fact: + sftp_key: "{{ sftp_key_promp.user_input | default('non') }}" \ No newline at end of file diff --git a/tasks/config_pool_php.yml b/tasks/config_pool_php.yml index 23173eb..19beffd 100644 --- a/tasks/config_pool_php.yml +++ b/tasks/config_pool_php.yml @@ -73,7 +73,7 @@ mode: '640' # or u=rwx,g=r,o= when: SITE == 'nuage' or SITE == 'paheko' or SITE == 'WP' -- name: ATTENTION la config php n'a pas été créer +- name: Message d'alerte si besoin ansible.builtin.debug: - msg: "Il n'y a pas de templates php pour votre site, il faudra le créer manuellement" + msg: "!!! ATTENTION !!! la config php n'a pas été créer car il n'y a pas de templates php pour votre site, il faudra le créer manuellement" when: SITE != 'nuage' and SITE != 'paheko' and SITE != 'WP' diff --git a/tasks/verif_installation_nextcloud.yml b/tasks/verif_installation_nextcloud.yml index b649e2e..d2b2569 100644 --- a/tasks/verif_installation_nextcloud.yml +++ b/tasks/verif_installation_nextcloud.yml @@ -24,12 +24,13 @@ msg: 'il faut déjà mettre à jour test-nuage avec cette version' when: not new_nextcloud_common.stat.exists and test_nuage is not defined -- name: Create new app common folder from old version one - become_user: nextcloud +- name: Création du dossier common de la nouvelle version en utilisant les apps de l'instance test-nuage become: true ansible.builtin.copy: - src: "{{ nextcloud_common_files_path }}/nextcloud-{{ ancienne_version }}/" + src: "/home/sites/data/org/heureux-cyclage/test-nuage/apps/" 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' + owner: nextcloud + group: nextcloud when: not new_nextcloud_common.stat.exists and test_nuage is defined -- 2.20.1