Smaine Kahlouch
9 years ago
15 changed files with 17619 additions and 162 deletions
Split View
Diff Options
-
6cluster.yml
-
13roles/common/defaults/main.yml
-
29roles/common/files/bootstrap.sh
-
17474roles/common/files/get-pip.py
-
3roles/common/files/runner
-
27roles/common/tasks/calico.yml
-
44roles/common/tasks/download.yml
-
39roles/common/tasks/flannel.yml
-
17roles/common/tasks/kubernetes.yml
-
24roles/common/tasks/main.yml
-
41roles/common/tasks/python-bootstrap.yml
-
16roles/download/defaults/main.yml
-
27roles/download/tasks/calico.yml
-
17roles/download/tasks/kubernetes.yml
-
4roles/download/tasks/main.yml
@ -0,0 +1,29 @@ |
|||
#/bin/bash |
|||
set -e |
|||
|
|||
BINDIR="/usr/local/bin" |
|||
|
|||
cd $BINDIR |
|||
|
|||
if [[ -e $BINDIR/.bootstrapped ]]; then |
|||
exit 0 |
|||
fi |
|||
|
|||
PYPY_VERSION=2.4.0 |
|||
|
|||
wget -O - https://bitbucket.org/pypy/pypy/downloads/pypy-$PYPY_VERSION-linux64.tar.bz2 |tar -xjf - |
|||
mv -n pypy-$PYPY_VERSION-linux64 pypy |
|||
|
|||
## library fixup |
|||
mkdir -p pypy/lib |
|||
ln -snf /lib64/libncurses.so.5.9 $BINDIR/pypy/lib/libtinfo.so.5 |
|||
|
|||
cat > $BINDIR/python <<EOF |
|||
#!/bin/bash |
|||
LD_LIBRARY_PATH=$BINDIR/pypy/lib:$LD_LIBRARY_PATH exec $BINDIR/pypy/bin/pypy "\$@" |
|||
EOF |
|||
|
|||
chmod +x $BINDIR/python |
|||
$BINDIR/python --version |
|||
|
|||
touch $BINDIR/.bootstrapped |
17474
roles/common/files/get-pip.py
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
BINDIR="/usr/local/bin" |
|||
LD_LIBRARY_PATH=$BINDIR/pypy/lib:$LD_LIBRARY_PATH $BINDIR/pypy/bin/$(basename $0) $@ |
@ -1,27 +0,0 @@ |
|||
--- |
|||
- 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] }}" |
|||
|
|||
|
|||
- name: Download calico-kubernetes-plugin |
|||
local_action: get_url |
|||
url="{{calico_plugin_download_url}}" |
|||
dest="{{ local_release_dir }}/calico/bin/calico" |
@ -1,39 +0,0 @@ |
|||
--- |
|||
- 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 |
@ -1,17 +0,0 @@ |
|||
--- |
|||
- name: Create kubernetes binary directory |
|||
local_action: file |
|||
path="{{ local_release_dir }}/kubernetes/bin" |
|||
state=directory |
|||
recurse=yes |
|||
|
|||
- name: Download kubelet and kubectl |
|||
local_action: get_url |
|||
url="{{ kube_download_url }}/{{ item.name }}" |
|||
dest="{{ local_release_dir }}/kubernetes/bin" |
|||
sha256sum="{{ item.checksum }}" |
|||
with_items: |
|||
- name: kubelet |
|||
checksum: "{{ kubelet_checksum }}" |
|||
- name: kubectl |
|||
checksum: "{{ kubectl_checksum }}" |
@ -0,0 +1,41 @@ |
|||
--- |
|||
- name: Python | Check if bootstrap is needed |
|||
raw: stat {{ bin_dir}}/.bootstrapped |
|||
register: need_bootstrap |
|||
ignore_errors: True |
|||
|
|||
- name: Python | Run bootstrap.sh |
|||
script: bootstrap.sh |
|||
when: need_bootstrap | failed |
|||
|
|||
- set_fact: |
|||
ansible_python_interpreter: "{{ bin_dir }}/python" |
|||
|
|||
- name: Python | Check if we need to install pip |
|||
shell: "{{ansible_python_interpreter}} -m pip --version" |
|||
register: need_pip |
|||
ignore_errors: True |
|||
changed_when: false |
|||
when: need_bootstrap | failed |
|||
|
|||
- name: Python | Copy get-pip.py |
|||
copy: src=get-pip.py dest=~/get-pip.py |
|||
when: need_pip | failed |
|||
|
|||
- name: Python | Install pip |
|||
shell: "{{ansible_python_interpreter}} ~/get-pip.py" |
|||
when: need_pip | failed |
|||
|
|||
- name: Python | Remove get-pip.py |
|||
file: path=~/get-pip.py state=absent |
|||
when: need_pip | failed |
|||
|
|||
- name: Python | Install pip launcher |
|||
copy: src=runner dest={{ bin_dir }}/pip mode=0755 |
|||
when: need_pip | failed |
|||
|
|||
- name: Install required python modules |
|||
pip: |
|||
name: "{{ item }}" |
|||
with_items: pip_python_modules |
|||
|
@ -1,16 +0,0 @@ |
|||
--- |
|||
etcd_version: v2.2.2 |
|||
flannel_version: 0.5.5 |
|||
|
|||
kube_version: v1.1.3 |
|||
kubectl_checksum: "01b9bea18061a27b1cf30e34fd8ab45cfc096c9a9d57d0ed21072abb40dd3d1d" |
|||
kubelet_checksum: "62191c66f2d670dd52ddf1d88ef81048977abf1ffaa95ee6333299447eb6a482" |
|||
|
|||
calico_version: v0.13.0 |
|||
calico_plugin_version: v0.7.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_plugin_download_url: "https://github.com/projectcalico/calico-kubernetes/releases/download/{{calico_plugin_version}}/calico_kubernetes" |
@ -1,27 +0,0 @@ |
|||
--- |
|||
- 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] }}" |
|||
|
|||
|
|||
- name: Download calico-kubernetes-plugin |
|||
local_action: get_url |
|||
url="{{calico_plugin_download_url}}" |
|||
dest="{{ local_release_dir }}/calico/bin/calico" |
@ -1,17 +0,0 @@ |
|||
--- |
|||
- name: Create kubernetes binary directory |
|||
local_action: file |
|||
path="{{ local_release_dir }}/kubernetes/bin" |
|||
state=directory |
|||
recurse=yes |
|||
|
|||
- name: Download kubelet and kubectl |
|||
local_action: get_url |
|||
url="{{ kube_download_url }}/{{ item.name }}" |
|||
dest="{{ local_release_dir }}/kubernetes/bin" |
|||
sha256sum="{{ item.checksum }}" |
|||
with_items: |
|||
- name: kubelet |
|||
checksum: "{{ kubelet_checksum }}" |
|||
- name: kubectl |
|||
checksum: "{{ kubectl_checksum }}" |
@ -1,4 +0,0 @@ |
|||
--- |
|||
- include: kubernetes.yml |
|||
- include: calico.yml |
|||
- include: flannel.yml |
Write
Preview
Loading…
Cancel
Save