- name: Lookup template
  debug:
    msg: "{{ lookup('template', './manifest_snmp_traps.j2') | from_yaml }}"

- name: Set default snmp traps manifest
  set_fact:
    snmp_traps_manifest: "{{ lookup('template', './manifest_snmp_traps.j2') | from_yaml }}"
  when: snmp_traps_manifest is not defined

- name: Create an instance of snmp webhook
  k8s:
    definition:
      '{{ snmp_traps_manifest }}'

- name: Set default snmp traps service manifest
  set_fact:
    snmp_traps_service_manifest: "{{ lookup('template', './manifest_snmp_traps_service.j2') | from_yaml }}"
  when: snmp_traps_service_manifest is not defined

- name: Create an instance of snmp webhook service
  k8s:
    definition:
      '{{ snmp_traps_service_manifest }}'
