Kamesh Sampath преди 5 години
родител
ревизия
9a731b68e2
променени са 4 файла, в които са добавени 39 реда и са изтрити 37 реда
  1. 22 24
      README.md
  2. 3 4
      requirements.yml
  3. 3 3
      tasks/minikube_create.yml
  4. 11 6
      tasks/minikube_pre_reqs.yml

+ 22 - 24
README.md

@@ -1,11 +1,8 @@
-Ansible role for minikube
-=====================
+# Ansible role for minikube
 
-Ansible to create [minikube](https://kind.sigs.k8s.io) cluster. 
+Ansible to create [minikube](https://minikube.sigs.k8s.io) cluster. 
 
-
-Requirements
-------------
+## Requirements
 
 - [Docker Desktop](https://www.docker.com/products/docker-desktop) or Docker for Linux
 
@@ -13,14 +10,12 @@ Requirements
 
 ```shell
 pip3 install \
-  -r https://raw.githubusercontent.com/kameshsampath/ansible-role-kind/master/requirements.txt
-ansible-galaxy role install kameshsampath.kind
-ansible-galaxy collection install community.kubernetes
+  -r https://raw.githubusercontent.com/kameshsampath/kameshsampath.minikube/master/requirements.txt
+ansible-galaxy role install -r https://raw.githubusercontent.com/kameshsampath/kameshsampath.minikube/master/requirements.yml
 ```
 __NOTE__: For Windows its recommended to use Windows Subsystem for Linux (WSL)
 
-Role Variables
---------------
+## Role Variables
 
 | Variable Name| Description | Default |
 |--|--|--|
@@ -35,30 +30,33 @@ Role Variables
 | minikube_disk_size| The disk size to use for minikube | 50g |
 | minikube_addons| the addons to enable bu default | registry and registry-aliases |
 
-License
--------
+## Creating a minikube cluster
+
+```shell
+  ansible-galaxy role install -r 
+```
 
-[Apache v2](https://github.com/kameshsampath/ansible-role-kind/tree/master/LICENSE)
+## License
 
-Author Information
-------------------
+[Apache v2](https://github.com/kameshsampath/kameshsampath.minikube/tree/master/LICENSE)
+
+## Author Information
 
 [Kamesh Sampath](mailto:kamesh.sampath@hotmail.com)
 
-Issues
-=======
+## Issues
+
+[Issues](https://github.com/kameshsampath/kameshsampath.minikube/issues)
+
+## Testing
 
-[Issues](https://github.com/kameshsampath/ansible-role-kind/issues)
 
-Testing
-=======
+### Requirements
 
-Requirements
-------------
 - Extra Python modules
 ```shell
 pip3 install \
-  -r https://raw.githubusercontent.com/kameshsampath/ansible-role-kind/master/molecule/requirements.txt
+  -r https://raw.githubusercontent.com/kameshsampath/kameshsampath.minikube/master/molecule/requirements.txt
 ```
 
 All tests are built using [molecule](https://molecule.readthedocs.io/en/latest/index.html) with following scenarios:

+ 3 - 4
requirements.yml

@@ -1,6 +1,5 @@
 ---
 roles:
-  - name: kameshsampath.k8s_app_spices
-collections:
-  - name: community.kubernetes
-    version: 0.11.1
+  - name: kameshsampath.minikube
+    src: https://github.com/kameshsampath/kameshsampath.minikube
+    version: master

+ 3 - 3
tasks/minikube_create.yml

@@ -14,14 +14,14 @@
     no_profiles: "{{ profile_check_result.stderr | regex_search('No minikube profile was found.*$') }}"
   when: profile_check_result.stderr is defined
 
-- nmae: Set existing profile name
+- name: Set existing profile name
   set_fact: 
     profile_name: '{{ profile_check_result.stdout_lines | join("~") | regex_search(minikube_profile_name)}}'
   when: no_profiles is not defined
 
 # - debug: msg="{{profile_check_result}}" 
 
-- name: "Create minikube profile {{minikube_profile_name}}"
+- name: "Create minikube with profile {{minikube_profile_name}}"
   command:
       argv:
         - "{{minikube_binary}}"
@@ -35,7 +35,7 @@
         - --delete-on-failure=true
         - --driver={{minikube_driver}}
   register: minikube_start_result
-  when: (no_profiles | length > 0) or (profile_name | length == 0)
+  when: (no_profiles is defined and no_profiles | length > 0) or (profile_name is defined and profile_name | length == 0)
 
 # - debug: msg="{{minikube_start_result}}"
 

+ 11 - 6
tasks/minikube_pre_reqs.yml

@@ -34,6 +34,11 @@
   set_fact:
     need_to_download: '{{ not minikube_stat_result.stat.exists or current_version is version(new_version,"<",strict=False)}}'
 
+- name: set minikube version fact
+  set_fact:
+    minikube_version: "{{new_version}}"
+  when: current_version is version(new_version,"<",strict=False)
+
 - name: Set minikube macOS download binary
   set_fact:
       minikube_download_binary: "https://github.com/kubernetes/minikube/releases/download/{{minikube_version}}/minikube-darwin-amd64"
@@ -61,15 +66,11 @@
     url: "{{minikube_download_binary}}"
     dest: "/usr/local/bin/minikube"
     mode: "0755"
+    force: yes
   become: yes
   when: need_to_download
   register: downloaded_minikube
 
-- name: set minikube binary fact
-  set_fact:
-    minikube_binary: /usr/local/bin/minikube
-    minikube_version: "{{new_version}}"
-
 - name: set the macOS default driver
   set_fact:
     minikube_driver: hyperkit
@@ -78,4 +79,8 @@
 - name: set the linux default driver
   set_fact:
     minikube_driver: kvm2
-  when: (ansible_os_family == "RedHat" or ansible_os_family == "CentOS" or ansible_os_family == "Debian") and minikube_driver_override is not defined
+  when: (ansible_os_family == "RedHat" or ansible_os_family == "CentOS" or ansible_os_family == "Debian") and minikube_driver_override is not defined
+
+- name: set minikube binary fact
+  set_fact:
+    minikube_binary: /usr/local/bin/minikube