Download role (#3553)

* codestyle tests

* Download destination can be different than local_release_dir
This commit is contained in:
Antoine Legrand 2018-10-20 13:56:55 +02:00 committed by GitHub
parent 56cafc3fb3
commit 2a3aa591e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 16 deletions

View file

@ -233,11 +233,10 @@ downloads:
file: "{{ etcd_deployment_type == 'host' }}"
enabled: true
version: "{{ etcd_version }}"
dest: "etcd-{{ etcd_version }}-linux-amd64.tar.gz"
dest: "{{local_release_dir}}/etcd-{{ etcd_version }}-linux-amd64.tar.gz"
repo: "{{ etcd_image_repo }}"
tag: "{{ etcd_image_tag }}"
sha256: "{{ etcd_binary_checksum if etcd_deployment_type == 'host' else etcd_digest_checksum|d(None) }}"
source_url: "{{ etcd_download_url }}"
url: "{{ etcd_download_url }}"
unarchive: true
owner: "root"
@ -249,9 +248,8 @@ downloads:
enabled: "{{ kubeadm_enabled }}"
file: true
version: "{{ kubeadm_version }}"
dest: "kubeadm"
dest: "{{local_release_dir}}/kubeadm"
sha256: "{{ kubeadm_binary_checksum }}"
source_url: "{{ kubeadm_download_url }}"
url: "{{ kubeadm_download_url }}"
unarchive: false
owner: "root"
@ -272,9 +270,8 @@ downloads:
enabled: true
file: true
version: "{{ kube_version }}"
dest: "hyperkube"
dest: "{{local_release_dir}}/hyperkube"
sha256: "{{ hyperkube_binary_checksum }}"
source_url: "{{ hyperkube_download_url }}"
url: "{{ hyperkube_download_url }}"
unarchive: false
owner: "root"
@ -527,12 +524,11 @@ downloads:
enabled: "{{ cert_management == 'vault' }}"
container: "{{ vault_deployment_type != 'host' }}"
file: "{{ vault_deployment_type == 'host' }}"
dest: "vault/vault_{{ vault_version }}_linux_{{ image_arch }}.zip"
dest: "{{local_release_dir}}/vault/vault_{{ vault_version }}_linux_{{ image_arch }}.zip"
mode: "0755"
owner: "vault"
repo: "{{ vault_image_repo }}"
sha256: "{{ vault_binary_checksum if vault_deployment_type == 'host' else vault_digest_checksum|d(none) }}"
source_url: "{{ vault_download_url }}"
tag: "{{ vault_image_tag }}"
unarchive: true
url: "{{ vault_download_url }}"

View file

@ -7,7 +7,7 @@
- name: file_download | Create dest directory
file:
path: "{{local_release_dir}}/{{download.dest|dirname}}"
path: "{{download.dest|dirname}}"
state: directory
recurse: yes
when:
@ -18,7 +18,7 @@
- name: file_download | Download item
get_url:
url: "{{download.url}}"
dest: "{{local_release_dir}}/{{download.dest}}"
dest: "{{download.dest}}"
sha256sum: "{{download.sha256 | default(omit)}}"
owner: "{{ download.owner|default(omit) }}"
mode: "{{ download.mode|default(omit) }}"
@ -26,7 +26,7 @@
register: get_url_result
until: "'OK' in get_url_result.msg or 'file already exists' in get_url_result.msg"
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
delay: "{{ retry_stagger | default(5) }}"
when:
- download.enabled
- download.file
@ -34,8 +34,8 @@
- name: file_download | Extract archives
unarchive:
src: "{{ local_release_dir }}/{{download.dest}}"
dest: "{{ local_release_dir }}/{{download.dest|dirname}}"
src: "{{download.dest}}"
dest: "{{download.dest|dirname}}"
owner: "{{ download.owner|default(omit) }}"
mode: "{{ download.mode|default(omit) }}"
copy: no

View file

@ -67,14 +67,16 @@
delay: "{{ agent_report_interval }}"
no_log: true
failed_when: false
when: not agents.content=='{}'
when:
- agents.content != '{}'
- debug: var=result.content|from_json
failed_when: not result is success
run_once: true
when: not agents.content=='{}'
when: not agents.content == '{}'
delegate_to: "{{groups['kube-master'][0]}}"
- debug: msg="Cannot get reports from agents, consider as PASSING"
run_once: true
when: agents.content=='{}'
when:
- agents.content == '{}'