- name: Check for Minikube install stat: path: /tmp/minikube register: stat_result - name: Download Minikube get_url: url: https://storage.googleapis.com/minikube/releases/{{ minikube_version }}/minikube-linux-amd64 dest: /tmp/minikube mode: 0755 when: not stat_result.stat.exists - name: Run install-docker role include_role: name: install-docker - name: Install crio when: kubernetes_runtime == 'cri-o' include_tasks: crio.yaml - name: Create .kube directory file: path: "{{ ansible_user_dir }}/.kube" state: directory mode: 0755 - name: Create .kube/config file file: path: "{{ ansible_user_dir }}/.kube/config" state: touch mode: 0644 - name: Create .minikube directory file: path: "{{ ansible_user_dir }}/.minikube" state: directory mode: 0755 - name: Default args set_fact: minikube_args: "" - name: Configure dns options if set block: - name: Write resolv.conf template: src: resolv.conf.j2 dest: "{{ ansible_user_dir }}/.minikube/k8s_resolv.conf" mode: "0444" - name: Set extra kube setttings set_fact: minikube_args: "--extra-config=kubelet.resolv-conf={{ ansible_user_dir }}/.minikube/k8s_resolv.conf" when: minikube_dns_resolvers - name: Start Minikube become: yes command: "/tmp/minikube start --v=7 --vm-driver=none --container-runtime={{ kubernetes_runtime }} {{ minikube_args }}" environment: MINIKUBE_WANTUPDATENOTIFICATION: false MINIKUBE_WANTREPORTERRORPROMPT: false MINIKUBE_WANTNONEDRIVERWARNING: false MINIKUBE_WANTKUBECTLDOWNLOADMSG: false CHANGE_MINIKUBE_NONE_USER: true MINIKUBE_HOME: "{{ ansible_user_dir }}" KUBECONFIG: "{{ ansible_user_dir }}/.kube/config" - name: Ensure minikube config is owned by ansible_user become: yes file: path: "{{ ansible_user_dir }}/.minikube/client.key" owner: "{{ ansible_user }}" - name: Get cluster info command: kubectl cluster-info