X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=creation_nouveau_site.yml;h=becb28f72e5dd1d0d0bf6a707c4a87559733e27b;hb=2ea484b79f456fc11514abcdf138582d892e718f;hp=cd2f0f2f3f5cbb80a608600f061e1fffa5c66a1a;hpb=f0a634c73af3548be7ea962f1065f6d1d9f69dd4;p=lhc%2Fansible.git diff --git a/creation_nouveau_site.yml b/creation_nouveau_site.yml index cd2f0f2..becb28f 100644 --- a/creation_nouveau_site.yml +++ b/creation_nouveau_site.yml @@ -2,22 +2,20 @@ # attention - Par défaut ce scipt se lancer vers ligatures - name: Promp pour définir les variables du nouveau ite - hosts: vm_debian11 # test avec un nom de vm + hosts: ligatures become: true # toutes les tâches seront pas défaut éxécuter en tant que root vars: # config_nginx: true à l'avenir on pourrait demander à l'utilisateur de choisir si il veut configurer nginx - php_version: 8.0 - postgres_version: 15 - nouvelle_version: 27.1.6 # nextcloud - ancienne_version: 27.1.5 # nextcloud + # nouvelle_version: 27.1.7 # nextcloud + # ancienne_version: 27.1.6 # nextcloud vars_prompt: - name: SITE - prompt: 'quel type de site?(ex: nuage, www, wiki, paheko)' + prompt: 'quel type de site?(ex: nuage, www, wiki, paheko ou gestion)' private: false - default: "paheko" + default: "nuage" - name: TLD prompt: 'TLD du site à mettre à jour?(ex: org)' @@ -59,7 +57,7 @@ - name: Vérifier le sigle n'est pas déjà utilisé ansible.builtin.lineinfile: dest: /etc/passwd - search_string: "site_{{ SIGLE }}" + search_string: "site_{{ SIGLE }}_{{ SITE }}" state: absent check_mode: true changed_when: false @@ -71,6 +69,18 @@ - name: Inclure la configuration d'un site web basique ansible.builtin.include_tasks: tasks/config_www.yml + - name: Inclure la configuration nginx + ansible.builtin.include_tasks: tasks/config_nginx.yml + vars: + template_site: "{{ SITE }}" + when: besoin_https == 'non' + +# scenario pre-install nginx sans ssl +# test installed=false or needupgrade:true +# test installed=true et needupgrade:false +# puis certbot à la fin +# puis template nginx ssl pour test manuel + - name: Bloc permettant de générer les certificats SSL when: besoin_https == 'oui' block: @@ -81,8 +91,9 @@ - name: Générer un certififat avec certbot # noqa : command-instead-of-module become: true - ansible.builtin.command: 'certbot certonly -i nginx -d {{ SITE }}.{{ DOMAIN }}.{{ TLD }}' + ansible.builtin.command: 'certbot certonly -n --nginx -d {{ SITE }}.{{ DOMAIN }}.{{ TLD }}' register: certbot_log + ignore_errors: true changed_when: false - name: Afficher les logs certbot @@ -90,15 +101,19 @@ var: certbot_log when: certbot_log is defined + - name: Activer la conf ssl dans nginx + ansible.builtin.set_fact: + ssl_ready: true + when: certbot_log is defined - - name: Inclure la configuration nginx - ansible.builtin.include_tasks: tasks/config_nginx.yml - vars: - template_site: "{{ SITE }}" + - name: Inclure la configuration nginx avec ssl + ansible.builtin.include_tasks: tasks/config_nginx.yml + vars: + template_site: "{{ SITE }}" - name: Inclure la configuration d'un pool PHP ansible.builtin.include_tasks: tasks/config_pool_php.yml - when: config_php == 'oui' or SITE == 'paheko' or SITE == 'nuage' + when: config_php == 'oui' or SITE == 'paheko' or SITE == 'gestion' or SITE == 'nuage' - name: Inclure la configuration nextcloud si besoin ansible.builtin.include_tasks: tasks/config_nuage.yml @@ -106,12 +121,9 @@ - name: Inclure la configuration paheko si besoin ansible.builtin.include_tasks: tasks/config_paheko.yml - when: SITE == 'paheko' - - # MAJ borgmatic conf -## Mettre à jour la conf de borgmatic pour intégrer les dossiers du nouveau nuage dans 'source_directories' + when: SITE == 'paheko' or SITE == 'gestion' - # vim /etc/borgmatic/config.yaml + - name: Inclure le configuration du backup + ansible.builtin.include_tasks: tasks/config_backup.yml - # - /home/sites/data/${TLD}/${DOMAIN}/${SITE}/config - # - /home/sites/data/${TLD}/${DOMAIN}/${SITE}/data \ No newline at end of file +# SFTP key