You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.9 KiB

---
- name: Copier un fichier via SCP
hosts: all:!splunk_uf_Linux_TIC
become: true
become_user: root
vars:
source_file: "/tmp/splunk-8.2.3-cd0848707637-Linux-x86_64.tgz"
destination_file: "/tmp/splunk-8.2.3-cd0848707637-Linux-x86_64.tgz"
remote_host: "10.10.30.38"
remote_user: "admin"
remote_password: "921223Jocpam!?"
tasks:
- name: Copier le fichier via SCP
command: scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {{ remote_user }}@{{ remote_host }}:{{ source_file }} {{ destination_file }}
- name: Vérifier si le fichier a été copié
stat:
path: "{{ destination_file }}"
register: file_stat
- name: Afficher un message d'erreur si le fichier n'a pas été copié
fail:
msg: "La copie SCP a échoué"
when: not file_stat.stat.exists
#- name: Copier depuis repo
#hosts: SVLCTPSUPPFI02.jpit.com
#become: true
#tasks:
#- name: copy
#copy:
#src: /tmp/splunkforwarder-8.2.3-cd0848707637-Linux-x86_64.tgz
#dest: /home/admin/splunkforwarder.tgz
#remote_src: true
#owner: admin
#group: admin
#mode: "0644"
#delegate_to: 10.10.30.38
# - name: Récupérer le fichier depuis l'hôte source et le copier sur l'hôte distant
# hosts: SVLCTPSUPPFI02.jpit.com
# become: true
# tasks:
# - name: Récupérer le fichier depuis l'hôte source
# fetch:
# src: /tmp/splunkforwarder-8.2.3-cd0848707637-Linux-x86_64.tgz
# dest: /tmp/
# flat: yes
# validate_checksum: yes
# fail_on_missing: yes
# fail_on_unreachable: yes
# delegate_to: 10.10.30.38
# - name: Copier le fichier vers l'hôte distant
# copy:
# src: /tmp/splunkforwarder-8.2.3-cd0848707637-Linux-x86_64.tgz
# dest: "{{ splunk_build_location_uf }}"
# owner: admin
# group: admin
# mode: "0644"