diff --git a/roles/operator/tasks/main.yaml b/roles/operator/tasks/main.yaml index 4ac48e5..6ebec53 100644 --- a/roles/operator/tasks/main.yaml +++ b/roles/operator/tasks/main.yaml @@ -10,6 +10,10 @@ - jo_image_tag != 'SetMe' - name: Deploy (with k8s kubeconfig) + when: jo_kubeconfig != 'SetMe' + module_defaults: + group/k8s: + kubeconfig: "{{ jo_kubeconfig }}" block: - name: Deploy (k8s kubeconfig) @@ -19,12 +23,8 @@ ansible.builtin.include_tasks: undeploy.yaml when: jo_state|string == 'absent' - module_defaults: - group/k8s: - kubeconfig: "{{ jo_kubeconfig }}" - when: jo_kubeconfig != 'SetMe' - - name: Deploy (with k8s host and API key) + when: jo_kubeconfig == 'SetMe' block: - name: Deploy (k8s API key) @@ -33,5 +33,3 @@ - name: Undeploy (k8s API key) ansible.builtin.include_tasks: undeploy.yaml when: jo_state|string == 'absent' - - when: jo_kubeconfig == 'SetMe' diff --git a/roles/operator/tasks/prep.yaml b/roles/operator/tasks/prep.yaml index ffa5393..6cf08f2 100644 --- a/roles/operator/tasks/prep.yaml +++ b/roles/operator/tasks/prep.yaml @@ -25,7 +25,7 @@ # expected environment variables so that we can assert they've been set. - name: Set initial authentication facts - set_fact: + ansible.builtin.set_fact: k8s_auth_host: "{{ lookup('env', 'K8S_AUTH_HOST') }}" k8s_auth_api_key: "{{ lookup('env', 'K8S_AUTH_API_KEY') }}" @@ -35,7 +35,7 @@ # Either way the variables 'k8s_auth_host' and # 'k8s_auth_api_key' must have been set. - name: Assert kubernetes authentication (no kubeconfig) - assert: + ansible.builtin.assert: that: - k8s_auth_host|string|length > 0 - k8s_auth_api_key|string|length > 0