From c4beee38f633aef97e73bc14ecd22104eff2cb26 Mon Sep 17 00:00:00 2001 From: Smana Date: Sun, 26 Jun 2016 21:14:45 +0200 Subject: [PATCH] include variables from a distinct file --- roles/download/defaults/main.yml | 7 +++---- roles/download/tasks/main.yml | 2 ++ roles/download/{defaults => vars}/kube_versions.yml | 0 roles/uploads/defaults/main.yml | 6 +++--- roles/uploads/tasks/main.yml | 2 ++ roles/uploads/{defaults => vars}/kube_versions.yml | 0 scripts/change_k8s_version.py | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) rename roles/download/{defaults => vars}/kube_versions.yml (100%) rename roles/uploads/{defaults => vars}/kube_versions.yml (100%) diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index 4643086b6..5128e8f3e 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -4,7 +4,6 @@ local_release_dir: /tmp # if this is set to true will only download files once download_run_once: False - # Versions include_vars: kube_versions.yml @@ -76,7 +75,7 @@ downloads: kubernetes_kubelet: version: "{{kube_version}}" dest: kubernetes/bin/kubelet - sha256: "{{kube_checksum.kubelet}}" + sha256: "{{vars['kube_checksum'][kube_version]['kubelet']}}" source_url: "{{ kubelet_download_url }}" url: "{{ kubelet_download_url }}" owner: "kube" @@ -84,7 +83,7 @@ downloads: kubernetes_kubectl: dest: kubernetes/bin/kubectl version: "{{kube_version}}" - sha256: "{{kube_checksum.kubectl}}" + sha256: "{{vars['kube_checksum'][kube_version]['kubectl']}}" source_url: "{{ kubectl_download_url }}" url: "{{ kubectl_download_url }}" owner: "kube" @@ -92,7 +91,7 @@ downloads: kubernetes_apiserver: dest: kubernetes/bin/kube-apiserver version: "{{kube_version}}" - sha256: "{{kube_checksum.kube_apiserver}}" + sha256: "{{vars['kube_checksum'][kube_version]['kube_apiserver']}}" source_url: "{{ apiserver_download_url }}" url: "{{ apiserver_download_url }}" owner: "kube" diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml index 40bd3c902..40c52f5ea 100644 --- a/roles/download/tasks/main.yml +++ b/roles/download/tasks/main.yml @@ -1,4 +1,6 @@ --- +- include_vars: kube_versions.yml + - name: downloading... debug: msg: "{{ download.url }}" diff --git a/roles/download/defaults/kube_versions.yml b/roles/download/vars/kube_versions.yml similarity index 100% rename from roles/download/defaults/kube_versions.yml rename to roles/download/vars/kube_versions.yml diff --git a/roles/uploads/defaults/main.yml b/roles/uploads/defaults/main.yml index 039c6656c..a8f1002e2 100644 --- a/roles/uploads/defaults/main.yml +++ b/roles/uploads/defaults/main.yml @@ -74,7 +74,7 @@ downloads: - name: kubernetes-kubelet version: "{{kube_version}}" dest: kubernetes/bin/kubelet - sha256: "{{kube_checksum.kubelet}}" + sha256: "{{vars['kube_checksum'][kube_version]['kubelet']}}" source_url: "{{ kube_download_url }}/kubelet" url: "{{ kube_download_url }}/kubelet" owner: "kube" @@ -83,7 +83,7 @@ downloads: - name: kubernetes-kubectl dest: kubernetes/bin/kubectl version: "{{kube_version}}" - sha256: "{{kube_checksum.kubectl}}" + sha256: "{{vars['kube_checksum'][kube_version]['kubectl']}}" source_url: "{{ kube_download_url }}/kubectl" url: "{{ kube_download_url }}/kubectl" owner: "kube" @@ -92,7 +92,7 @@ downloads: - name: kubernetes-apiserver dest: kubernetes/bin/kube-apiserver version: "{{kube_version}}" - sha256: "{{kube_checksum.kube_apiserver}}" + sha256: "{{vars['kube_checksum'][kube_version]['kube_apiserver']}}" source_url: "{{ kube_download_url }}/kube-apiserver" url: "{{ kube_download_url }}/kube-apiserver" owner: "kube" diff --git a/roles/uploads/tasks/main.yml b/roles/uploads/tasks/main.yml index 279d26dd5..b19c2aa93 100644 --- a/roles/uploads/tasks/main.yml +++ b/roles/uploads/tasks/main.yml @@ -1,4 +1,6 @@ --- +- include_vars: "kube_versions.yml" + - name: Create the checksum file lineinfile: create: yes diff --git a/roles/uploads/defaults/kube_versions.yml b/roles/uploads/vars/kube_versions.yml similarity index 100% rename from roles/uploads/defaults/kube_versions.yml rename to roles/uploads/vars/kube_versions.yml diff --git a/scripts/change_k8s_version.py b/scripts/change_k8s_version.py index 1fc7d0972..6ffbc7946 100644 --- a/scripts/change_k8s_version.py +++ b/scripts/change_k8s_version.py @@ -94,7 +94,7 @@ if __name__ == '__main__': file_sub('../roles/kubernetes/node/defaults/main.yml', r'.*hyperkube_image_tag.*', 'hyperkube_image_tag: "%s"' % args.kube_version) kube_binaries = ['kubelet', 'kubectl', 'kube-apiserver'] - var_files = ['../roles/uploads/defaults/kube_versions.yml', '../roles/download/defaults/kube_versions.yml'] + var_files = ['../roles/uploads/vars/kube_versions.yml', '../roles/download/vars/kube_versions.yml'] kube_download_url = "https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/amd64" % args.kube_version new = get_kube_sha256(args.kube_version, kube_download_url, kube_binaries)