From 2a99a85faee3243c5abb1710383867c2b5ba2d4d Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 23 Mar 2022 05:04:46 +0300 Subject: [PATCH] Feat(playbooks/fetch-push): Fetch/push a list of files File names are separated by a comma, no space. --- playbooks/fetch-push/fetch.yml | 5 +++-- playbooks/fetch-push/push.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/playbooks/fetch-push/fetch.yml b/playbooks/fetch-push/fetch.yml index 37510a4..b2f20c8 100644 --- a/playbooks/fetch-push/fetch.yml +++ b/playbooks/fetch-push/fetch.yml @@ -1,9 +1,10 @@ -- name: "Fetch {{ file }}" +- name: "Fetch files" hosts: "{{ hosts | default('all') }}" gather_facts: false tasks: - name: Fetch files fetch: - src: "{{ file }}" + src: "{{ item }}" dest: "{{ start_dir }}/{{ inventory_hostname }}/" flat: yes + loop: "{{ files.split(',') }}" diff --git a/playbooks/fetch-push/push.yml b/playbooks/fetch-push/push.yml index 247ac74..1965adc 100644 --- a/playbooks/fetch-push/push.yml +++ b/playbooks/fetch-push/push.yml @@ -1,12 +1,13 @@ -- name: "Push {{ file }}" +- name: "Push files" hosts: "{{ hosts | default('all') }}" become: yes gather_facts: false tasks: - name: Copy files copy: - src: "{{ start_dir }}/{{ inventory_hostname }}/{{ file }}" + src: "{{ start_dir }}/{{ inventory_hostname }}/{{ item }}" dest: "{{ dest_dir }}" owner: "{{ owner | default('root') }}" group: "{{ group | default('root') }}" mode: "{{ mode | default('0644') }}" + loop: "{{ files.split(',') }}" -- 2.39.2