---
- name: Create temp directory for doing work in
  command: mktemp -td openshift-provisioners-ansible-XXXXXX
  register: mktemp
  changed_when: False
  check_mode: no

- name: Copy the admin client config(s)
  command: >
    cp {{ openshift.common.config_base}}/master/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  changed_when: False
  check_mode: no
  tags: provisioners_init

- include: "{{ role_path }}/tasks/install_provisioners.yaml"
  when: openshift_provisioners_install_provisioners | default(false) | bool

- include: "{{ role_path }}/tasks/uninstall_provisioners.yaml"
  when: not openshift_provisioners_install_provisioners | default(false) | bool

- name: Delete temp directory
  file:
    name: "{{ mktemp.stdout }}"
    state: absent
  tags: provisioners_cleanup
  changed_when: False
  check_mode: no
