---
- name: Kubernetes Apps | Lay Down nodelocaldns Template
  template:
    src: "{{ item.file }}.j2"
    dest: "{{ kube_config_dir }}/{{ item.file }}"
  with_items:
    - { name: nodelocaldns, file: nodelocaldns-config.yml, type: configmap }
    - { name: nodelocaldns, file: nodelocaldns-sa.yml, type: sa }
    - { name: nodelocaldns, file: nodelocaldns-deamonset.yml, type: daemonset }
  register: nodelocaldns_manifests
  vars:
    clusterIP: "{{ skydns_server }}"
    secondaryclusterIP: "{{ skydns_server_secondary }}"
  when:
    - enable_nodelocaldns == True
    - inventory_hostname == groups['kube-master'] | first
  tags:
    - nodelocaldns
