geerlingguy.ansible-role-ku.../tasks/main.yml
2018-05-09 09:35:24 -05:00

40 lines
1.0 KiB
YAML

---
- include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
- include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian'
- name: Ensure depdencies are installed.
package: name=curl state=present
- name: Install Kubernetes packages.
package:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
notify: restart kubelet
with_items: "{{ kubernetes_packages }}"
- name: Ensure kubelet is started and enabled at boot.
service:
name: kubelet
state: started
enabled: yes
- name: Initialize the Kubernetes master with kubeadm init.
command: >
kubeadm init
--pod-network-cidr=10.0.1.0/16
--apiserver-advertise-address={{ ansible_default_ipv4.address }}
--kubernetes-version stable-1.10
--ignore-preflight-errors=all
register: kubeadmin_init
failed_when: False
- name: Print the init output to screen.
debug: var=kubeadmin_init.stdout
# TODO: Set up Flannel.
# TODO: Allow pods on master with `kubectl taint nodes --all node-role.kubernetes.io/master-`