- name: install rsync
  yum:
    name: rsync
    state: present

- name: create local dir to store images
  local_action: "command mkdir -p {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing"

- name: create delorean_hash files
  local_action: "command echo {{ delorean_hash }} {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing/delorean_hash"

- name: fetch files to local workspace
  synchronize:
    src: "{{ working_dir }}/{{ item }}"
    dest: "{{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing/{{ item }}"
    mode: pull
  with_items: "{{ artifacts }}"

- name: publish to artifacts.centos
  local_action: "command rsync --delete -av {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing/ rdo@artifacts.ci.centos.org::rdo/images/{{ release }}/{{ build_system }}/testing/"

- name: remove the images from the workspace
  local_action: "command rm -rf {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing"

- name: install rsync
  yum:
    name: rsync
    state: present
  become: true

- name: create local dir to store images
  local_action: "command mkdir -p {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing"

- name: create delorean_hash files
  local_action: "command echo {{ delorean_hash }} {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing/delorean_hash"

- name: fetch files to local workspace
  synchronize:
    src: "{{ working_dir }}/{{ item }}"
    dest: "{{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing/{{ item }}"
    mode: pull
  with_items: "{{ artifacts }}"

- name: publish to artifacts.centos
  local_action: "command rsync --delete -av {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing/ rdo@artifacts.ci.centos.org::rdo/images/{{ release }}/{{ build_system }}/testing/"

- name: remove the images from the workspace
  local_action: "command rm -rf {{ lookup('env', 'WORKSPACE') }}/images/{{ release }}/{{ build_system }}/testing"

Use sudo to install rsync for image publishing
Use sudo to install rsync for image publishing

Change-Id: I7ca7ad629c3a1c2b4f644460d3e47a1d5d60a07f
