From e7d5b7af670618865344f10f149b265fb9a43ca1 Mon Sep 17 00:00:00 2001
From: Greg Althaus <galthaus@austin.rr.com>
Date: Mon, 25 Jan 2016 13:30:48 -0600
Subject: [PATCH] Force owner and permissions for get_url retrieved files. 
 get_url doesn't honor owner and mode is spotty.

---
 roles/download/tasks/main.yml | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml
index 86271120f..6e88b2afe 100644
--- a/roles/download/tasks/main.yml
+++ b/roles/download/tasks/main.yml
@@ -14,8 +14,17 @@
 
 - name: Extract archives
   unarchive:
-     src: "{{ local_release_dir }}/{{item.dest}}"
-     dest: "{{ local_release_dir }}/{{item.dest|dirname}}"
-     copy: no
+    src: "{{ local_release_dir }}/{{item.dest}}"
+    dest: "{{ local_release_dir }}/{{item.dest|dirname}}"
+    copy: no
   when: "{{item.unarchive is defined and item.unarchive == True}}"
   with_items: downloads
+
+- name: Fix permissions
+  file:
+    state: file
+    path: "{{local_release_dir}}/{{item.dest}}"
+    owner: "{{ item.owner|default(omit) }}"
+    mode: "{{ item.mode|default(omit) }}"
+  when: "{{item.unarchive is not defined or item.unarchive == False}}"
+  with_items: downloads
-- 
GitLab