From 17618a8c8e9ccd2365577faa6e8dfbbf41fc7020 Mon Sep 17 00:00:00 2001 From: Elam Monnot Date: Thu, 26 Jan 2023 11:55:37 +0100 Subject: [PATCH] modif nfs-server --- roles/lb-nfs-server/README.md | 2 +- roles/lb-nfs-server/tasks/main.yml | 87 +++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 15 deletions(-) diff --git a/roles/lb-nfs-server/README.md b/roles/lb-nfs-server/README.md index e66df5a..cb8c76b 100644 --- a/roles/lb-nfs-server/README.md +++ b/roles/lb-nfs-server/README.md @@ -5,6 +5,6 @@ Ce rôle : * installe **nfs-server** * copie le fichier de configuration **exports** pour exporter le répertoire **/home/wordpress** * relance le service **nfs-server** - + * décompresse wordpress ### Objectif Le répertoire **/home/wordpress** est exporté par **nfs** sur le réseau **n-dmz-db** diff --git a/roles/lb-nfs-server/tasks/main.yml b/roles/lb-nfs-server/tasks/main.yml index 3f9b4a4..f87b678 100644 --- a/roles/lb-nfs-server/tasks/main.yml +++ b/roles/lb-nfs-server/tasks/main.yml @@ -1,18 +1,77 @@ ---- - - name: installation des paquets - apt: - name: - - nfs-kernel-server - state: latest + - name: 00 - cree repertoire wordpress pour export nfs + file: + path: /exports/wordpress + state: directory - - name: copie exports pour partage nfs wordpress - copy: - src: exports - dest: /etc + - name: 05 - Install nfs-server + apt: + name: nfs-server + state: present - - name: redemarrage du service rpcbind requis pour le service nfs - shell: service rpcbind restart + - name: 10 - creation fichier exports nfs + ansible.builtin.blockinfile: + path: /etc/exports + block: | + /exports/wordpress 192.168.56.0/255.255.255.0 (rw,no_root_squash,subtree_check) - - name: redemarrage du service nfs-kernel-server - shell: service nfs-kernel-server restart + + - name: 15 - Recupere wordpress.tar.gz + get_url: + url: "https://fr.wordpress.org/latest-fr_FR.tar.gz" + dest: /tmp/wordpress-6.1.1-fr_FR.tar.gz + + - name: 20 - decompresse wordpress + unarchive: + src: /tmp/wordpress-6.1.1-fr_FR.tar.gz + dest: /exports/ + remote_src: yes + + - name: 22 - change owner et group pour repertoire wordpress + file: + path: /exports/wordpress + state: directory + recurse: yes + owner: www-data + group: www-data + + - name: 30 - genere fichier de config wordpress + copy: + src: /exports/wordpress/wp-config-sample.php + dest: /exports/wordpress/wp-config.php + remote_src: yes + + - name: 35 - ajuste variable dbname dans fichier de config wp-config.php + replace: + path: /exports/wordpress/wp-config.php + regexp: "votre_nom_de_bdd" + replace: "wordpressdb" + backup: yes + + + - name: 40 ajuste variable dbusername dans fichier de config wp-config.php + replace: + path: /exports/wordpress/wp-config.php + regexp: "votre_utilisateur_de_bdd" + replace: "wordpressuser" + backup: yes + + - name: 45 - ajuste variable mdp dans fichier de config wp-config.php + replace: + path: /exports/wordpress/wp-config.php + regexp: "votre_mdp_de_bdd" + replace: "wordpresspasswd" + backup: yes + + - name: 50 - ajuste hostname fichier wp-config.php + replace: + path: /exports/wordpress/wp-config.php + regexp: "localhost" + replace: "192.168.102.253" + backup: yes + + - name: 55 - relance nfs + service: + name: nfs-server + state: restarted + enabled: yes