---
- name: Stat conf files paths
  stat:
    path: "/etc/ipsec.d/{{ inventory_hostname }}-to-{{ item }}.conf"
  register: conf
  loop: "{{ groups['testing'] }}"

- name: Stat secrets files paths
  stat:
    path: "/etc/ipsec.d/{{ inventory_hostname }}-to-{{ item }}.secrets"
  register: secrets
  loop: "{{ groups['testing'] }}"

- name: Assert that ipsec.conf and secrets files exist
  assert:
    that:
      - item.stat.exists
  loop: "{{ conf.results }}"

- name: Assert that ipsec.conf and secrets files exist
  assert:
    that:
      - item.stat.exists
  loop: "{{ secrets.results }}"
