forked from jonathanmedd/Playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_gcpstorage.yml
35 lines (31 loc) · 1.14 KB
/
test_gcpstorage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- hosts: all
vars:
file_vars:
- "/opt/binaries/powershell-yaml/0.4.0/powershell-yaml.psd1"
- "/opt/binaries/powershell-yaml/0.4.0/powershell-yaml.psm1"
tasks:
- name: Checking existing files
stat:
path: "{{ item }}"
with_items: "{{ file_vars }}"
register: check_files
# - debug:
# msg: "File {{item.item}} has exists status of {{ item.stat.exists }}"
# with_items: "{{ check_files.results }}"
# when: check_files.results[0].stat.exists == true and check_files.results[1].stat.exists == true
- name: Test Download
gc_storage:
gs_access_key: "{{ gcp_access_key }}"
gs_secret_key: "{{ gcp_secret_key }}"
bucket: "test290506"
object: "powershell-yaml.zip"
dest: "/opt/binaries/powershell-yaml.zip"
mode: "get"
when: check_files.results[0].stat.exists == false and check_files.results[1].stat.exists == false
- name: Unarchive powershell-yaml.zip
unarchive:
src: "/opt/binaries/powershell-yaml.zip"
dest: "/opt/binaries"
remote_src: yes
when: check_files.results[0].stat.exists == false and check_files.results[1].stat.exists == false