---
# generate the templates for project to be created
- name: fetch keytab to location used in create template step
  ansible.builtin.fetch:
    src: "/etc/openshift_apps/fas2discourse/fas2discourse{{ env_suffix }}-keytab.kt"
    dest: "/etc/openshift_apps/fas2discourse/fas2discourse{{ env_suffix }}-keytab.kt"
    flat: True
    mode: 0600

# generate the templates for project to be created
- name: copy the templates to the host
  template:
    src: "secret-keytab.yml"
    dest: "/root/ocp4/openshift-apps/fas2discourse-operator/secret-keytab.yml"
    mode: 0770
  vars:
    fas2discourse_keytab_file:
      "{{ lookup('file',
      '/etc/openshift_apps/fas2discourse/fas2discourse{{ env_suffix }}-keytab.kt')
      }}"

# apply created openshift resources
- name: oc apply resources
  command: "/root/bin/oc apply -f /root/ocp4/openshift-apps/fas2discourse-operator/secret-keytab.yml"

