- name: Set the Kubernetes Context
  shell: "kubectl config set-context {{ kubernetes_context }}"

- name: Get Namespace Detail
  shell: "kubectl get namespace {{ kubernetes_namespace }}"
  register: namespace_details
  ignore_errors: yes

- name: Create AWX Kubernetes Project
  shell: "kubectl create namespace {{ kubernetes_namespace }}"
  when: namespace_details.rc != 0

- name: Set postgresql service name
  set_fact:
    postgresql_service_name: "{{ kubernetes_deployment_name }}-postgresql"
  when: "pg_hostname is not defined or pg_hostname == ''"

- name: Set the Kubernetes Context
  shell: "kubectl config use-context {{ kubernetes_context }}"

- name: Get Namespace Detail
  shell: "kubectl get namespace {{ kubernetes_namespace }}"
  register: namespace_details
  ignore_errors: yes

- name: Create AWX Kubernetes Project
  shell: "kubectl create namespace {{ kubernetes_namespace }}"
  when: namespace_details.rc != 0

- name: Set postgresql service name
  set_fact:
    postgresql_service_name: "{{ kubernetes_deployment_name }}-postgresql"
  when: "pg_hostname is not defined or pg_hostname == ''"

Use use-context to set Kubernetes context
Use use-context to set Kubernetes context

`kubectl config use-context` is the command to set the current context,
not `set-context`

Signed-off-by: Will Thames <37d41699bdee4fcb969ca499eb0f8b82c60d59cc@thames.id.au>
