---
- name: Build kustomize testing overlay
  # load_restrictor must be set to none so we can load patch files from the default overlay
  command: '{{ kustomize }} build  --load_restrictor none .'
  args:
    chdir: '{{ config_dir }}/testing'
  register: resources
  changed_when: false

- name: Set resources to {{ state }}
  k8s:
    definition: '{{ item }}'
    state: '{{ state }}'
    wait: yes
  loop: '{{ resources.stdout | from_yaml_all | list }}'
