---
- name: install coredumpctl
  apt:
    name:
      - systemd-coredump
    cache_valid_time: 3600
    update_cache: yes

- name: mkdir /opt/testenv-coredump-helper
  ansible.builtin.file:
    path: /opt/testenv-coredump-helper
    state: directory

- name: install testenv-coredump-helper
  ansible.builtin.copy:
    src: testenv-coredump-helper.py
    dest: /opt/testenv-coredump-helper/testenv-coredump-helper
    mode: '0755'
  notify: restart testenv-coredump-helper

- name: install testenv-coredump-helper service
  ansible.builtin.copy:
    src: testenv-coredump-helper.service
    dest: /etc/systemd/system/testenv-coredump-helper.service
    mode: '0644'
  notify: restart testenv-coredump-helper

- name: enable testenv-coredump-helper service
  ansible.builtin.systemd_service:
    name: testenv-coredump-helper
    enabled: true
