---
- name: Install Kubernetes packages (RHEL/CentOS)
  when: ansible_os_family == "RedHat"
  yum:
    name: "{{ item }}"
    update_cache: yes
  with_items:
    -  kubectl
    -  kubelet
    -  kubernetes-cni
  register: masterpackage

- name: Install Kubernetes packages (Debian/Ubuntu)
  when: ansible_os_family == "Debian"
  apt:
    name: "{{ item }}"
    update_cache: yes
  with_items:
    -  kubectl
    -  kubelet
    -  kubernetes-cni
  register: masterpackage

- name: Create and copy master config file
  include: config.yml

- name: Reload systemd daemon
  command: systemctl daemon-reload

- name: Enable and restart kubelet
  service: name=kubelet enabled=yes state=restarted
  register: kubelet_start

---
- name: Install Kubernetes packages (RHEL/CentOS)
  when: ansible_os_family == "RedHat"
  yum:
    name: "{{ item }}"
    update_cache: yes
  with_items:
    -  kubectl
    -  kubelet
    -  kubernetes-cni
  register: masterpackage

- name: Install Kubernetes packages (Debian/Ubuntu)
  when: ansible_os_family == "Debian"
  apt:
    name: "{{ item }}"
    update_cache: yes
  with_items:
    -  kubectl
    -  kubelet
    -  kubernetes-cni
  register: masterpackage

- name: Create and copy master config file
  include: config.yml

- name: Reload systemd daemon
  command: systemctl daemon-reload

- name: Enable and restart kubelet
  service: name=kubelet enabled=yes state=restarted
  register: kubelet_start

- name: Wait for API server start
  when: kubelet_start
  wait_for:
    host: "127.0.0.1"
    port: "8080"
    connect_timeout: 5
    state: started

Add wait for apiserver start step
master: Add wait for apiserver start step
