Download role (#3553)

* codestyle tests

* Download destination can be different than local_release_dir
pull/3565/head
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' }}" file: "{{ etcd_deployment_type == 'host' }}"
enabled: true enabled: true
version: "{{ etcd_version }}" 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 }}" repo: "{{ etcd_image_repo }}"
tag: "{{ etcd_image_tag }}" tag: "{{ etcd_image_tag }}"
sha256: "{{ etcd_binary_checksum if etcd_deployment_type == 'host' else etcd_digest_checksum|d(None) }}" sha256: "{{ etcd_binary_checksum if etcd_deployment_type == 'host' else etcd_digest_checksum|d(None) }}"
source_url: "{{ etcd_download_url }}"
url: "{{ etcd_download_url }}" url: "{{ etcd_download_url }}"
unarchive: true unarchive: true
owner: "root" owner: "root"
@ -249,9 +248,8 @@ downloads:
enabled: "{{ kubeadm_enabled }}" enabled: "{{ kubeadm_enabled }}"
file: true file: true
version: "{{ kubeadm_version }}" version: "{{ kubeadm_version }}"
dest: "kubeadm" dest: "{{local_release_dir}}/kubeadm"
sha256: "{{ kubeadm_binary_checksum }}" sha256: "{{ kubeadm_binary_checksum }}"
source_url: "{{ kubeadm_download_url }}"
url: "{{ kubeadm_download_url }}" url: "{{ kubeadm_download_url }}"
unarchive: false unarchive: false
owner: "root" owner: "root"
@ -272,9 +270,8 @@ downloads:
enabled: true enabled: true
file: true file: true
version: "{{ kube_version }}" version: "{{ kube_version }}"
dest: "hyperkube" dest: "{{local_release_dir}}/hyperkube"
sha256: "{{ hyperkube_binary_checksum }}" sha256: "{{ hyperkube_binary_checksum }}"
source_url: "{{ hyperkube_download_url }}"
url: "{{ hyperkube_download_url }}" url: "{{ hyperkube_download_url }}"
unarchive: false unarchive: false
owner: "root" owner: "root"
@ -527,12 +524,11 @@ downloads:
enabled: "{{ cert_management == 'vault' }}" enabled: "{{ cert_management == 'vault' }}"
container: "{{ vault_deployment_type != 'host' }}" container: "{{ vault_deployment_type != 'host' }}"
file: "{{ 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" mode: "0755"
owner: "vault" owner: "vault"
repo: "{{ vault_image_repo }}" repo: "{{ vault_image_repo }}"
sha256: "{{ vault_binary_checksum if vault_deployment_type == 'host' else vault_digest_checksum|d(none) }}" sha256: "{{ vault_binary_checksum if vault_deployment_type == 'host' else vault_digest_checksum|d(none) }}"
source_url: "{{ vault_download_url }}"
tag: "{{ vault_image_tag }}" tag: "{{ vault_image_tag }}"
unarchive: true unarchive: true
url: "{{ vault_download_url }}" url: "{{ vault_download_url }}"

View File

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

View File

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