Commit 204e0630 authored by eric pellegrini's avatar eric pellegrini

added playbook and associated roles for setting up kubernetes

parent a4ae635d
......@@ -4,71 +4,6 @@
remote_user: root
roles:
- role: roles/configure-environment
- hosts: all
remote_user: root
roles:
- role: roles/setup-docker
- role: roles/setup-kubernetes
- hosts: all
remote_user: root
environment:
no_proxy: "{{ configured_no_proxy }}"
NO_PROXY: "{{ configured_no_proxy }}"
roles:
- role: roles/cleanup-cni-interface
- hosts: master
remote_user: root
environment:
no_proxy: "{{ configured_no_proxy }}"
NO_PROXY: "{{ configured_no_proxy }}"
roles:
- role: roles/initialize-cluster
- role: roles/create-kubernetes-admin
- hosts: master
remote_user: kub-admin
environment:
no_proxy: "{{ configured_no_proxy }}"
NO_PROXY: "{{ configured_no_proxy }}"
roles:
- role: roles/setup-kubernetes-network
- hosts: nodes
remote_user: root
environment:
no_proxy: "{{ configured_no_proxy }}"
NO_PROXY: "{{ configured_no_proxy }}"
roles:
- role: roles/setup-kubernetes-nodes
- hosts: master
remote_user: kub-admin
environment:
no_proxy: "{{ configured_no_proxy }}"
NO_PROXY: "{{ configured_no_proxy }}"
roles:
- role: roles/setup-helm-package-manager
- role: roles/install-kubernetes
- role: roles/configure-kubernetes
---
- name: remove swapfile from /etc/fstab
mount:
name: "{{ item }}"
fstype: swap
state: absent
loop:
- swap
- none
- name: disable swap
command: swapoff -a
when: ansible_swaptotal_mb > 0
- name: update kernel settings
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: 1
sysctl_set: yes
state: present
reload: yes
- name: restart kubelet
service:
name: kubelet
daemon_reload: yes
state: restarted
- name: create user kubernetes-admin
user:
create_home: yes
home: "{{ kubernetes_admin_home }}"
group: kubernetes
name: kubernetes-admin
shell: /bin/bash
state: present
- name: add no_proxy to .bashrc
blockinfile:
path: "{{ kubernetes_admin_home }}/.bashrc"
block: |
export no_proxy="{{ configured_no_proxy }}"
export NO_PROXY=$no_proxy
---
- name: Kubelet restart
service:
name: kubelet
state: restarted
- name: install apt dependencies
apt:
name: "{{ item }}"
update_cache: true
loop:
- apt-transport-https
- curl
- name: fetch and install the gpg key for kubernetes
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: add kubernetes repository
apt_repository:
repo: deb [arch=amd64] http://apt.kubernetes.io kubernetes-xenial main
state: present
filename: kubernetes
- name: install kubernetes
apt:
name: "{{ item }}"
update_cache: true
force_apt_get: yes
loop:
- kubelet
- kubeadm
- kubectl
notify: kubeadm version
- name: hold kubernetes packages
command: apt-mark hold kubelet kubeadm kubectl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment