Browse Source

fixing permissions on extract dir if needed

Grega Bremec 1 năm trước cách đây
mục cha
commit
042565b6d8
3 tập tin đã thay đổi với 11 bổ sung0 xóa
  1. 1 0
      inventory.yml
  2. 9 0
      roles/pull-files/tasks/sequence.yml
  3. 1 0
      roles/pull-files/vars/main.yml

+ 1 - 0
inventory.yml

@@ -100,6 +100,7 @@ all:
       - name: source-to-image-v1.3.8-980ca195-linux-amd64.tar.gz
         url: https://github.com/openshift/source-to-image/releases/download/v1.3.8/source-to-image-v1.3.8-980ca195-linux-amd64.tar.gz
         extract_to: /usr/local/bin
+        extract_fix_perms: 0755
         target_path: /usr/local/bin/s2i
         remove_after: yes
 ...

+ 9 - 0
roles/pull-files/tasks/sequence.yml

@@ -68,6 +68,15 @@
     - item.extract_to is defined
     - downloaded.changed
 
+- name: reset permissions if needed
+  become: yes
+  file:
+    path: "{{ item.extract_to }}"
+    mode: "{{ item.extract_fix_perms }}"
+  when:
+    - item.extract_fix_perms is defined
+    - item.extract_to is defined
+
 - name: Rename wherever the archive extracted to whatever new name is required, if so
   become: yes
   command: mv {{ item.extracted_dir }} {{ item.target_path }}

+ 1 - 0
roles/pull-files/vars/main.yml

@@ -5,6 +5,7 @@
 #   url: https://direct.url/to/file.txt
 #   checksum: sha256:xxxxxxxxxx
 #   extract_to: /opt
+#   extract_fix_perms: 0755
 #   extracted_dir: /opt/foobar
 #   target_path: /opt/newname
 #   add_to_path: yes