---
- name: Copy calico yaml
  template:
    src: calico.yaml.j2
    dest: /tmp/calico.yaml

- name: Copy metric server yaml
  template:
    src: components.yaml.j2
    dest: /tmp/components.yaml

- name: Configure Calico networking.
  command: kubectl apply -f /tmp/calico.yaml
  register: calico_result
  changed_when: "'created' in calico_result.stdout"
  when: kubernetes_pod_network.cni == 'calico'

- name: Configure Metric Server
  command: kubectl apply -f /tmp/components.yaml
  register: metric_server_result
  changed_when: "'created' in metric_server_result.stdout"
