common role in order to support other linux distribs
parent
9f07f2a951
commit
dbb6f4934e
|
@ -1,11 +1,7 @@
|
||||||
---
|
---
|
||||||
- hosts: downloader
|
|
||||||
sudo: no
|
|
||||||
roles:
|
|
||||||
- { role: download, tags: download }
|
|
||||||
|
|
||||||
- hosts: k8s-cluster
|
- hosts: k8s-cluster
|
||||||
roles:
|
roles:
|
||||||
|
- { role: common, tags: common }
|
||||||
- { role: docker, tags: docker }
|
- { role: docker, tags: docker }
|
||||||
- { role: kubernetes/node, tags: node }
|
- { role: kubernetes/node, tags: node }
|
||||||
- { role: etcd, tags: etcd }
|
- { role: etcd, tags: etcd }
|
||||||
|
|
|
@ -5,16 +5,19 @@ flannel_version: 0.5.5
|
||||||
kube_version: v1.1.3
|
kube_version: v1.1.3
|
||||||
kubectl_checksum: "01b9bea18061a27b1cf30e34fd8ab45cfc096c9a9d57d0ed21072abb40dd3d1d"
|
kubectl_checksum: "01b9bea18061a27b1cf30e34fd8ab45cfc096c9a9d57d0ed21072abb40dd3d1d"
|
||||||
kubelet_checksum: "62191c66f2d670dd52ddf1d88ef81048977abf1ffaa95ee6333299447eb6a482"
|
kubelet_checksum: "62191c66f2d670dd52ddf1d88ef81048977abf1ffaa95ee6333299447eb6a482"
|
||||||
|
kube_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kube_version }}/bin/linux/amd64"
|
||||||
|
|
||||||
calico_version: v0.13.0
|
calico_version: v0.13.0
|
||||||
calico_plugin_version: v0.7.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"
|
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_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"
|
calico_plugin_download_url: "https://github.com/projectcalico/calico-kubernetes/releases/download/{{calico_plugin_version}}/calico_kubernetes"
|
||||||
|
|
||||||
ansible_python_interpreter: PATH="{{ ansible_user_dir }}"/bin:$PATH python
|
req_debian_pkg:
|
||||||
pip_python_modules:
|
- python-httplib2
|
||||||
- httplib2
|
- python-apt
|
||||||
|
- python-pip
|
||||||
|
|
||||||
|
pypy_version: 2.4.0
|
||||||
|
python_pypy_url: "https://bitbucket.org/pypy/pypy/downloads/pypy-{{ pypy_version }}.tar.bz2"
|
||||||
|
|
|
@ -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
|
File diff suppressed because it is too large
Load Diff
|
@ -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,4 +1,31 @@
|
||||||
---
|
---
|
||||||
|
- 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"
|
||||||
|
|
||||||
- name: Create flannel release directory
|
- name: Create flannel release directory
|
||||||
local_action: file
|
local_action: file
|
||||||
path={{ local_release_dir }}/flannel
|
path={{ local_release_dir }}/flannel
|
||||||
|
@ -37,3 +64,20 @@
|
||||||
local_action: file
|
local_action: file
|
||||||
path={{ local_release_dir }}/flannel/flannel-{{ flannel_version }} state=absent
|
path={{ local_release_dir }}/flannel/flannel-{{ flannel_version }} state=absent
|
||||||
when: dl_flannel|changed
|
when: dl_flannel|changed
|
||||||
|
|
||||||
|
- 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,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 }}"
|
|
|
@ -3,10 +3,24 @@
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: inventory_hostname == "{{ groups['kube-master'][0] }}"
|
when: inventory_hostname == "{{ groups['kube-master'][0] }}"
|
||||||
|
|
||||||
- include: pip-bootstrap.yml
|
- name: "Identify init system"
|
||||||
|
shell: >
|
||||||
|
if $(pgrep systemd > /dev/null); then
|
||||||
|
echo systemd;
|
||||||
|
else echo sysvinit;
|
||||||
|
fi
|
||||||
|
always_run: True
|
||||||
|
register: init_system_output
|
||||||
|
|
||||||
- name: Install httplib2 python module
|
- set_fact:
|
||||||
pip:
|
init_system: "{{ init_system_output.stdout }}"
|
||||||
executable: "{{ ansible_user_dir }}/bin/pip"
|
|
||||||
|
- name: Install debian packages requirements
|
||||||
|
apt:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
with_items: pip_python_modules
|
state: latest
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
with_items: req_debian_pkg
|
||||||
|
|
||||||
|
- include: python-bootstrap.yml
|
||||||
|
when: ansible_os_family not in [ "Debian", "RedHat" ]
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue