diff --git a/defaults/main.yml b/defaults/main.yml index 6aa0689..064b3ee 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -64,3 +64,6 @@ add_workers_to_hostfile: false # for setting up custom certificate request. Set to template name to enable #microk8s_csr_template: null + +# when /snap/bin is not in the PATH +microk8s_bin_path: "" diff --git a/tasks/addons.yml b/tasks/addons.yml index 64efb09..252fae6 100644 --- a/tasks/addons.yml +++ b/tasks/addons.yml @@ -1,7 +1,7 @@ - name: get current addons state become: yes command: - cmd: microk8s.status --format yaml + cmd: "{{ microk8s_bin_path }}microk8s.status --format yaml" changed_when: no register: microk8s_status check_mode: no @@ -16,7 +16,7 @@ loop_control: label: "{{ item.name }}" command: - cmd: microk8s.enable {{ item.name }}{% if microk8s_plugins[item.name] != True %}:{{ microk8s_plugins[item.name] }}{% endif %} + cmd: "{{ microk8s_bin_path }}microk8s.enable {{ item.name }}{% if microk8s_plugins[item.name] != True %}:{{ microk8s_plugins[item.name] }}{% endif %}" when: - item.status == 'disabled' - item.name in microk8s_plugins @@ -28,7 +28,7 @@ loop_control: label: "{{ item.name }}" command: - cmd: microk8s.disable {{ item.name }} + cmd: "{{ microk8s_bin_path }}microk8s.disable {{ item.name }}" when: - item.status == 'enabled' - item.name in microk8s_plugins diff --git a/tasks/install.yml b/tasks/install.yml index 8b6a1b3..e778e9f 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -34,7 +34,7 @@ - name: Wait for microk8s to be ready become: yes - command: microk8s.status --wait-ready + command: "{{ microk8s_bin_path }}microk8s.status --wait-ready" changed_when: false register: mk8sstatusout failed_when: