From 28b3b7f575aba126621f18d0ca6e98cb3dd68e23 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio Date: Oct 02 2020 18:43:37 +0000 Subject: Add sync-hosts.yml playbook --- diff --git a/playbooks/manual/sync-hosts.yml b/playbooks/manual/sync-hosts.yml new file mode 100644 index 0000000..acda283 --- /dev/null +++ b/playbooks/manual/sync-hosts.yml @@ -0,0 +1,29 @@ +# Synchronizes files in /tmp/staging between remote hosts +# The following variables need to be supplied with the +# --extra-vars flag for the playbook to work: +# 'remote_src_host', 'remote_dest_host' +# +# Example: +# ansible-playbook sync-hosts.yml --extra-vars \ +# "remote_src_host=bodhi-backend01.iad2.fedoraproject.org \ +# remote_dest_host=sundries01.iad2.fedoraproject.org" +--- +- hosts: localhost + user: root + + tasks: + + - name: copy files from remote_src_host to control node + run_once: yes + fetch: + src: /tmp/staging + dest: /tmp/staging + flat: yes + validate_checksum: yes + when: "{{ inventory_hostname == 'remote_src_host' }}" + + - name: copy files from control node to remote_dest_host + copy: + src: /tmp/staging + dest: /tmp/staging + when: "{{ inventory_hostname == 'remote_dest_host' }}"