- hosts: all
  become: yes
  tasks:
    - name: install Docker
      apt:
        name: docker.io
        state: present
        update_cache: true

    - name: install APT Transport HTTPS
      apt:
        name: apt-transport-https
        state: present

    - name: add Kubernetes apt-key
      apt_key:
        url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
        state: present

    - name: add Kubernetes' APT repository
      apt_repository:
        repo: deb http://apt.kubernetes.io/ kubernetes-xenial main
        state: present
        filename: 'kubernetes'

    - name: install kubelet
      apt:
        name: kubelet=1.18.0-00
        state: present
        update_cache: true

    - name: install kubeadm
      apt:
        name: kubeadm=1.18.0-00
        state: present

- hosts: master
  become: yes
  tasks:
   - name: install kubectl
     apt:
       name: kubectl=1.18.0-00
       state: present
       force: yes    
