mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-28 09:39:12 +03:00
Initial commit
This commit is contained in:
5
roles/download/defaults/main.yml
Normal file
5
roles/download/defaults/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
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
|
||||
21
roles/download/tasks/calico.yml
Normal file
21
roles/download/tasks/calico.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Create calico release directory
|
||||
local_action: file
|
||||
path={{ local_release_dir }}/calico/bin
|
||||
recurse=yes
|
||||
state=directory
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Check if calicoctl has been downloaded
|
||||
local_action: stat
|
||||
path={{ local_release_dir }}/calico/bin/calicoctl
|
||||
register: c_tar
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
# issues with get_url module and redirects, to be tested again in the near future
|
||||
- name: Download calico
|
||||
local_action: shell
|
||||
curl -o {{ local_release_dir }}/calico/bin/calicoctl -Ls {{ calico_download_url }}/{{ calico_version }}/calicoctl
|
||||
when: not c_tar.stat.exists
|
||||
register: dl_calico
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
42
roles/download/tasks/etcd.yml
Normal file
42
roles/download/tasks/etcd.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
- name: Create etcd release directory
|
||||
local_action: file
|
||||
path={{ local_release_dir }}/etcd/bin
|
||||
recurse=yes
|
||||
state=directory
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Check if etcd release archive has been downloaded
|
||||
local_action: stat
|
||||
path={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz
|
||||
register: e_tar
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
# issues with get_url module and redirects, to be tested again in the near future
|
||||
- name: Download etcd
|
||||
local_action: shell
|
||||
curl -o {{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz -Ls {{ etcd_download_url }}/{{ etcd_version }}/etcd-{{ etcd_version }}-linux-amd64.tar.gz
|
||||
when: not e_tar.stat.exists
|
||||
register: dl_etcd
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Extract etcd archive
|
||||
local_action: unarchive
|
||||
src={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz
|
||||
dest={{ local_release_dir }}/etcd copy=no
|
||||
when: dl_etcd|changed
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Pick up only etcd binaries
|
||||
local_action: copy
|
||||
src={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/{{ item }}
|
||||
dest={{ local_release_dir }}/etcd/bin
|
||||
with_items:
|
||||
- etcdctl
|
||||
- etcd
|
||||
when: dl_etcd|changed
|
||||
|
||||
- name: Delete unused etcd files
|
||||
local_action: file
|
||||
path={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64 state=absent
|
||||
when: dl_etcd|changed
|
||||
39
roles/download/tasks/flannel.yml
Normal file
39
roles/download/tasks/flannel.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: Create flannel release directory
|
||||
local_action: file
|
||||
path={{ local_release_dir }}/flannel
|
||||
recurse=yes
|
||||
state=directory
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Check if flannel release archive has been downloaded
|
||||
local_action: stat
|
||||
path={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz
|
||||
register: f_tar
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
# issues with get_url module and redirects, to be tested again in the near future
|
||||
- name: Download flannel
|
||||
local_action: shell
|
||||
curl -o {{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz -Ls {{ flannel_download_url }}/v{{ flannel_version }}/flannel-{{ flannel_version }}-linux-amd64.tar.gz
|
||||
when: not f_tar.stat.exists
|
||||
register: dl_flannel
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Extract flannel archive
|
||||
local_action: unarchive
|
||||
src={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz
|
||||
dest={{ local_release_dir }}/flannel copy=no
|
||||
when: dl_flannel|changed
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
|
||||
- name: Pick up only flannel binaries
|
||||
local_action: copy
|
||||
src={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}/flanneld
|
||||
dest={{ local_release_dir }}/flannel/bin
|
||||
when: dl_flannel|changed
|
||||
|
||||
- name: Delete unused flannel files
|
||||
local_action: file
|
||||
path={{ local_release_dir }}/flannel/flannel-{{ flannel_version }} state=absent
|
||||
when: dl_flannel|changed
|
||||
47
roles/download/tasks/kubernetes.yml
Normal file
47
roles/download/tasks/kubernetes.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
- name: Create kubernetes release directory
|
||||
local_action: file
|
||||
path={{ local_release_dir }}/kubernetes
|
||||
state=directory
|
||||
|
||||
- name: Check if kubernetes release archive has been downloaded
|
||||
local_action: stat
|
||||
path={{ local_release_dir }}/kubernetes/kubernetes.tar.gz
|
||||
register: k_tar
|
||||
|
||||
# issues with get_url module and redirects, to be tested again in the near future
|
||||
- name: Download kubernetes
|
||||
local_action: shell
|
||||
curl -o {{ local_release_dir }}/kubernetes/kubernetes.tar.gz -Ls {{ kube_download_url }}/{{ kube_version }}/kubernetes.tar.gz
|
||||
when: not k_tar.stat.exists or k_tar.stat.checksum != "{{ kube_sha1 }}"
|
||||
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
|
||||
5
roles/download/tasks/main.yml
Normal file
5
roles/download/tasks/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- include: kubernetes.yml
|
||||
- include: etcd.yml
|
||||
- include: calico.yml
|
||||
- include: flannel.yml
|
||||
8
roles/download/vars/main.yml
Normal file
8
roles/download/vars/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
etcd_version: v2.2.0
|
||||
flannel_version: 0.5.3
|
||||
|
||||
kube_version: v1.0.6
|
||||
kube_sha1: 289f9a11ea2f3cfcc6cbd50d29c3d16d4978b76c
|
||||
|
||||
calico_version: v0.5.1
|
||||
Reference in New Issue
Block a user