download only required kubernetes binaries

pull/22/head
Smaine Kahlouch 2015-12-11 11:47:51 +01:00
parent e0ec3e7241
commit 3981b73924
2 changed files with 22 additions and 50 deletions

View File

@ -1,13 +1,15 @@
--- ---
etcd_download_url: https://github.com/coreos/etcd/releases/download
flannel_download_url: https://github.com/coreos/flannel/releases/download
kube_download_url: https://github.com/GoogleCloudPlatform/kubernetes/releases/download
calico_download_url: https://github.com/Metaswitch/calico-docker/releases/download
etcd_version: v2.2.2 etcd_version: v2.2.2
flannel_version: 0.5.5 flannel_version: 0.5.5
kube_version: v1.1.2 kube_version: v1.1.2
kube_sha1: 69d110d371752c6492d2f8695aa7a47be5b6ed4e kubectl_checksum: "e0585c6e63f796d87b34cd1f16554892a49421b98a2862a896b2b7ebf1439ace"
kubelet_checksum: "6c029d34888e1ec4b9ab4b500b0712388984340488c5f3c19e2c759d1003cbff"
calico_version: v0.12.0
etcd_download_url: "https://github.com/coreos/etcd/releases/download"
flannel_download_url: "https://github.com/coreos/flannel/releases/download"
kube_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kube_version }}/bin/linux/amd64"
calico_download_url: "https://github.com/Metaswitch/calico-docker/releases/download"
calico_version: v0.11.0

View File

@ -1,47 +1,17 @@
--- ---
- name: Create kubernetes release directory - name: Create kubernetes binary directory
local_action: file local_action: file
path={{ local_release_dir }}/kubernetes path="{{ local_release_dir }}/kubernetes/bin"
state=directory state=directory
recurse=yes
- name: Check if kubernetes release archive has been downloaded - name: Download kubelet and kubectl
local_action: stat local_action: get_url
path={{ local_release_dir }}/kubernetes/kubernetes.tar.gz url="{{ kube_download_url }}/{{ item.name }}"
register: k_tar dest="{{ local_release_dir }}/kubernetes/bin"
sha256sum="{{ item.checksum }}"
# issues with get_url module and redirects, to be tested again in the near future with_items:
- name: Download kubernetes - name: kubelet
local_action: shell checksum: "{{ kubelet_checksum }}"
curl -o {{ local_release_dir }}/kubernetes/kubernetes.tar.gz -Ls {{ kube_download_url }}/{{ kube_version }}/kubernetes.tar.gz - name: kubectl
when: not k_tar.stat.exists or k_tar.stat.checksum != "{{ kube_sha1 }}" checksum: "{{ kubectl_checksum }}"
register: dl_kube
- name: Compare kubernetes archive checksum
local_action: stat
path={{ local_release_dir }}/kubernetes/kubernetes.tar.gz
register: k_tar
failed_when: k_tar.stat.checksum != "{{ kube_sha1 }}"
when: dl_kube|changed
- name: Extract kubernetes archive
local_action: unarchive
src={{ local_release_dir }}/kubernetes/kubernetes.tar.gz
dest={{ local_release_dir }}/kubernetes copy=no
when: dl_kube|changed
- name: Extract kubernetes binaries archive
local_action: unarchive
src={{ local_release_dir }}/kubernetes/kubernetes/server/kubernetes-server-linux-amd64.tar.gz
dest={{ local_release_dir }}/kubernetes copy=no
when: dl_kube|changed
- name: Pick up only kubernetes binaries
local_action: synchronize
src={{ local_release_dir }}/kubernetes/kubernetes/server/bin
dest={{ local_release_dir }}/kubernetes
when: dl_kube|changed
- name: Delete unused kubernetes files
local_action: file
path={{ local_release_dir }}/kubernetes/kubernetes state=absent
when: dl_kube|changed