Changed to webdav
This commit is contained in:
+16
-8
@@ -4,6 +4,12 @@
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
vars:
|
||||
nas_url: "https://dartydisk5.maison:5006" # ex: https://192.168.1.10:5006
|
||||
nas_path: "/Datas/NetworkConfigs" # dossier WebDAV
|
||||
nas_user: "stephane.david"
|
||||
nas_pass: "St&ph@ne"
|
||||
|
||||
tasks:
|
||||
# -------------------------------------------------------
|
||||
# Étape 1 – Récupérer les infos réseau ET DNS du serveur cible
|
||||
@@ -30,11 +36,13 @@
|
||||
args:
|
||||
creates: "/tmp/config_{{ inventory_hostname }}.txt"
|
||||
|
||||
# -------------------------------------------------------
|
||||
# Étape 3 – Uploader le fichier vers le serveur SFTP
|
||||
# -------------------------------------------------------
|
||||
- name: Rapatrier le fichier vers AWX
|
||||
ansible.builtin.fetch:
|
||||
src: "/tmp/config_{{ inventory_hostname }}.txt"
|
||||
dest: "artifacts/"
|
||||
flat: yes
|
||||
- name: Upload vers NAS via WebDAV
|
||||
uri:
|
||||
url: "{{ nas_url }}{{ nas_path }}/config_{{ inventory_hostname }}.txt"
|
||||
method: PUT
|
||||
user: "{{ nas_user }}"
|
||||
password: "{{ nas_pass }}"
|
||||
force_basic_auth: yes
|
||||
body: "{{ lookup('file', '/tmp/config_' ~ inventory_hostname ~ '.txt') }}"
|
||||
status_code: 201, 204
|
||||
validate_certs: no
|
||||
Reference in New Issue
Block a user