Change curl method add executable permission

This commit is contained in:
Yosafat Marselino 2025-05-16 06:11:18 -04:00
parent bef29c551d
commit a9e1a43b80

View File

@ -9,15 +9,22 @@
state: directory
mode: '0755'
- name: Download scripts from remote sources
get_url:
url: "{{ item.url }}"
dest: "/tmp/downloaded_scripts/{{ item.name }}"
mode: '0755' # Make executable
- name: Download scripts using curl
command: >
curl "{{ item.url }}" -o "/tmp/downloaded_scripts/{{ item.name }}"
args:
creates: "/tmp/downloaded_scripts/{{ item.name }}"
loop:
- { name: 'script1.sh', url: 'https://git.nnag.me/infidel/jenkins-smo-autodeployment/raw/branch/master/test-scripts/install_k8s.sh' }
register: downloaded_scripts
- name: Make downloaded scripts executable
file:
path: "/tmp/downloaded_scripts/{{ item.name }}"
mode: '0755'
loop:
- { name: 'script1.sh' }
- name: Execute downloaded scripts
shell: "/tmp/downloaded_scripts/{{ item.item.name }}"
loop: "{{ downloaded_scripts.results }}"