Antoine Legrand
9 years ago
9 changed files with 157 additions and 44 deletions
Split View
Diff Options
-
41.travis.yml
-
17inventory/local-tests.cfg
-
41roles/dnsmasq/tasks/main.yml
-
9roles/dnsmasq/templates/resolv.conf.j2
-
16roles/kubernetes/master/tasks/main.yml
-
44roles/kubernetes/node/tasks/install.yml
-
3roles/kubernetes/preinstall/tasks/main.yml
-
15roles/network_plugin/tasks/calico.yml
-
15roles/network_plugin/tasks/flannel.yml
@ -0,0 +1,41 @@ |
|||
sudo: required |
|||
dist: trusty |
|||
language: python |
|||
python: "2.7" |
|||
|
|||
addons: |
|||
hosts: |
|||
- node1 |
|||
|
|||
env: |
|||
- SITE=cluster.yml |
|||
|
|||
before_install: |
|||
- sudo apt-get update -qq |
|||
|
|||
install: |
|||
# Install Ansible. |
|||
- sudo -H pip install ansible |
|||
- sudo -H pip install netaddr |
|||
|
|||
cache: |
|||
directories: |
|||
- $HOME/releases |
|||
- $HOME/.cache/pip |
|||
|
|||
before_script: |
|||
- export PATH=$PATH:/usr/local/bin |
|||
|
|||
script: |
|||
# Check the role/playbook's syntax. |
|||
- "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --syntax-check" |
|||
|
|||
# Run the role/playbook with ansible-playbook. |
|||
- "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local" |
|||
|
|||
# Run the role/playbook again, checking to make sure it's idempotent. |
|||
- > |
|||
sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local |
|||
| tee /dev/stderr | grep -q 'changed=0.*failed=0' |
|||
&& (echo 'Idempotence test: pass' && exit 0) |
|||
|| (echo 'Idempotence test: fail' && exit 1) |
@ -0,0 +1,17 @@ |
|||
node1 ansible_connection=local local_release_dir={{ansible_env.HOME}}/releases |
|||
|
|||
[downloader] |
|||
node1 |
|||
|
|||
[kube-master] |
|||
node1 |
|||
|
|||
[etcd] |
|||
node1 |
|||
|
|||
[kube-node] |
|||
node1 |
|||
|
|||
[k8s-cluster:children] |
|||
kube-node |
|||
kube-master |
@ -1,9 +0,0 @@ |
|||
; generated by ansible |
|||
search {{ [ 'default.svc.' + dns_domain, 'svc.' + dns_domain, dns_domain ] | join(' ') }} |
|||
{% if inventory_hostname in groups['kube-master'] %} |
|||
nameserver {{ ansible_default_ipv4.address }} |
|||
{% else %} |
|||
{% for host in groups['kube-master'] %} |
|||
nameserver {{ hostvars[host]['ansible_default_ipv4']['address'] }} |
|||
{% endfor %} |
|||
{% endif %} |
@ -1,36 +1,50 @@ |
|||
--- |
|||
- name: Write kubelet systemd init file |
|||
- debug: msg="{{init_system == "systemd"}}" |
|||
- debug: msg="{{init_system}}" |
|||
|
|||
- name: install | Write kubelet systemd init file |
|||
template: src=kubelet.service.j2 dest=/etc/systemd/system/kubelet.service backup=yes |
|||
when: init_system == "systemd" |
|||
notify: restart systemd-kubelet |
|||
|
|||
- name: Write kubelet initd script |
|||
- name: install | Write kubelet initd script |
|||
template: src=deb-kubelet.initd.j2 dest=/etc/init.d/kubelet owner=root mode=755 backup=yes |
|||
when: init_system == "sysvinit" and ansible_os_family == "Debian" |
|||
notify: restart kubelet |
|||
|
|||
- name: Write kubelet initd script |
|||
- name: install | Write kubelet initd script |
|||
template: src=rh-kubelet.initd.j2 dest=/etc/init.d/kubelet owner=root mode=755 backup=yes |
|||
when: init_system == "sysvinit" and ansible_os_family == "RedHat" |
|||
notify: restart kubelet |
|||
|
|||
- name: Install kubelet binary |
|||
copy: |
|||
src={{ local_release_dir }}/kubernetes/bin/kubelet |
|||
dest={{ bin_dir }} |
|||
owner=kube |
|||
mode=0755 |
|||
- name: install | Install kubelet binary |
|||
synchronize: |
|||
src: "{{ local_release_dir }}/kubernetes/bin/kubelet" |
|||
dest: "{{ bin_dir }}/kubelet" |
|||
mode: pull |
|||
times: yes |
|||
archive: no |
|||
delegate_to: "{{ groups['downloader'][0] }}" |
|||
notify: |
|||
- restart kubelet |
|||
|
|||
- name: Calico-plugin | Directory |
|||
- name: install | Perms kubelet binary |
|||
file: path={{ bin_dir }}/kubelet owner=kube mode=0755 state=file |
|||
|
|||
- name: install | Calico-plugin | Directory |
|||
file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/ state=directory |
|||
when: kube_network_plugin == "calico" |
|||
|
|||
- name: Calico-plugin | Binary |
|||
copy: |
|||
src={{ local_release_dir }}/calico/bin/calico |
|||
dest=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico |
|||
mode=0755 |
|||
- name: install | Calico-plugin | Binary |
|||
synchronize: |
|||
src: "{{ local_release_dir }}/calico/bin/calico" |
|||
dest: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico" |
|||
mode: "pull" |
|||
times: yes |
|||
archive: no |
|||
delegate_to: "{{ groups['downloader'][0] }}" |
|||
when: kube_network_plugin == "calico" |
|||
notify: restart kubelet |
|||
|
|||
- name: install | Perms calico plugin binary |
|||
file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico owner=kube mode=0755 state=file |
Write
Preview
Loading…
Cancel
Save