]> git.phdru.name Git - ansible.git/commitdiff
Feat(fetch-push): Allow plain directory
authorOleg Broytman <phd@phdru.name>
Thu, 11 Jan 2024 12:29:55 +0000 (15:29 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 11 Jan 2024 18:17:27 +0000 (21:17 +0300)
Allow to omit hostname directory.

playbooks/fetch-push/fetch.yaml
playbooks/fetch-push/push.yaml

index b2f20c862425215a7a9ae49fd56ef65a8646e538..59214cb00aaf39128c3643df9d407bd7423832c6 100644 (file)
@@ -5,6 +5,6 @@
     - name: Fetch files
       fetch:
         src: "{{ item }}"
-        dest: "{{ start_dir }}/{{ inventory_hostname }}/"
+        dest: "{{ start_dir }}/{% if not plain_dir %}{{ inventory_hostname }}/{% endif %}"
         flat: yes
       loop: "{{ files.split(',') }}"
index b2ad0e2062760f8e73d33a98fecb7670072a6683..35379b6f1533e381069ab48139e8e8b6e6b2eabe 100644 (file)
@@ -5,7 +5,7 @@
   tasks:
     - name: Copy files
       copy:
-        src: "{{ start_dir }}/{{ inventory_hostname }}/{{ item }}"
+        src: "{{ start_dir }}/{% if not plain_dir %}{{ inventory_hostname }}/{% endif %}{{ item }}"
         dest: "{{ dest_dir }}/"
         owner: "{{ owner | default('root') }}"
         group: "{{ group | default('root') }}"