---
- name: Create the directories to hold the templates
  file:
    path: "/root/ocp4/openshift-apps/{{project_name}}"
    state: directory
    owner: root
    group: root
    mode: 0770
    recurse: true

# generate the templates for project to be created
- name: create the templates
  template:
    src: "{{ item }}"
    dest: "/root/ocp4/openshift-apps/{{project_name}}/{{ item }}"
    mode: 0770
  with_items: "{{ project_templates }}"

# apply created openshift resources
- name: oc apply resources
  command: "/root/bin/oc apply -f /root/ocp4/openshift-apps/{{project_name}}/{{ item }}"
  with_items: "{{ project_templates }}"
