File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,20 @@ Example Playbook
8282 - role : AnsibleShipyard.ansible-zookeeper
8383` ` `
8484
85+ Example Retrieving Tarball From S3
86+ ----------------------------------
87+
88+ ` ` ` yaml
89+ - name : Installing ZooKeeper
90+ hosts : all
91+ sudo : yes
92+ vars :
93+ zookeeper_archive_s3_bucket : my-s3-bucket
94+ zookeeper_archive_s3_object : my/s3/directory/zookeeper-{{zookeeper_version}}.tar.gz
95+ roles :
96+ - role : AnsibleShipyard.ansible-zookeeper
97+ ` ` `
98+
8599Cluster Example
86100----------------
87101
Original file line number Diff line number Diff line change 55- name : " Ensure the zookeeper dir exists at {{zookeeper_dir}}"
66 file : path={{zookeeper_dir}} state=directory
77
8+ # If the file exists already, the S3 call can experience errors
9+ - name : check whether the tarball is downloaded already
10+ stat : path={{zookeeper_tarball_dir}}/zookeeper-{{zookeeper_version}}.tar.gz
11+ register : zookeeper_tarball_script
12+
13+ - name : Download zookeeper from S3
14+ s3 :
15+ mode : get
16+ bucket : " {{zookeeper_archive_s3_bucket}}"
17+ object : " {{zookeeper_archive_s3_object}}"
18+ dest : " {{zookeeper_tarball_dir}}/zookeeper-{{zookeeper_version}}.tar.gz"
19+ register : zookeeper_s3_tarball_downloaded
20+ tags : bootstrap
21+ when : >
22+ zookeeper_archive_s3_bucket is defined and
23+ zookeeper_archive_s3_object is defined and
24+ not zookeeper_tarball_script.stat.exists
25+
826 - name : Download zookeeper version.
927 get_url : url={{zookeeper_url}} dest={{zookeeper_tarball_dir}}/zookeeper-{{zookeeper_version}}.tar.gz
1028 tags : bootstrap
29+ register : zookeeper_tarball_downloaded
30+ when : >
31+ zookeeper_archive_s3_bucket is not defined or
32+ zookeeper_archive_s3_object is not defined
1133
1234 - name : Unpack tarball.
1335 command : tar zxf {{zookeeper_tarball_dir}}/zookeeper-{{zookeeper_version}}.tar.gz --strip-components=1 chdir={{zookeeper_dir}} creates={{zookeeper_dir}}/bin
You can’t perform that action at this time.
0 commit comments