main.yml 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. ---
  2. # tasks file for kubernetes_kubelet
  3. - name: Install kubernetes
  4. yum: pkg=kubernetes state=installed
  5. - name: Configure kubelet
  6. lineinfile: >
  7. dest=/etc/sysconfig/kubernetes
  8. regexp={{ item.regex }}
  9. line="{{ item.line }}"
  10. with_items:
  11. - { regex: '^KUBE_ETCD_SERVERS=', line: 'KUBE_ETCD_SERVERS=\"http://{{ oo_master_ips[0] }}:4001\"' }
  12. - { regex: '^KUBE_KUBELET_ADDRESS=', line: 'KUBE_KUBELET_ADDRESS=\"0.0.0.0\"' }
  13. - { regex: '^KUBE_KUBELET_HOSTNAME_OVERRIDE=', line: 'KUBE_KUBELET_HOSTNAME_OVERRIDE=\"{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address }}\"' }
  14. notify:
  15. - restart kubelet
  16. #- name: write the cadvisor config
  17. # template: src=cadvisor.manifest dest=/etc/kubernetes/manifests/cadvisor.manifest
  18. # notify:
  19. # - restart kubelet
  20. - name: Enable kubelet
  21. service: name=kubernetes-kubelet enabled=yes state=started
  22. - name: Open firewalld port for the kubelet
  23. firewalld: port=10250/tcp permanent=false state=enabled
  24. - name: Save firewalld port for the kubelet
  25. firewalld: port=10250/tcp permanent=true state=enabled