---
-
  name: "Checking if Domino has been installed"
  register: domino_server_installed
  ansible.builtin.stat:
    path: "{{ domino_home_dir }}/notes.ini"
    get_md5: false

-
  name: "Stopping Domino and disabling Domino"
  when: domino_server_installed.stat.exists
  become: true
  ansible.builtin.service:
    name: domino
    state: stopped
    enabled: false

-
  name: "Removing Domino Data Directories"
  become: true
  when: domino_server_installed.stat.exists
  ansible.builtin.file:
    mode: '0644'
    path: "{{ item.path }}"
    state: "absent"
  with_items:
    - { path: "{{ domino_home_dir }}/ids/" }
    - { path: "{{ domino_home_dir }}/" }
    - { path: "{{ domino_install_basedir }}/" }
    - { path: "{{ completed_dir }}/fpinstalled" }
    - { path: "{{ completed_dir }}/hfinstalled" }
    - { path: "{{ completed_dir }}/verse_install" }
    - { path: "{{ completed_dir }}/traveler_install" }
    - { path: "{{ completed_dir }}/nomadweb_install" }
    - { path: "{{ completed_dir }}/leap_install" }
    - { path: "{{ completed_dir }}/htmo_installed" }
    - { path: "{{ completed_dir }}/service_configured" }
    - { path: "{{ completed_dir }}/domsetup" }
    - { path: "{{ completed_dir }}/kyr-cert-imported" }
    - { path: "{{ completed_dir }}/kyr-key-imported" }
    - { path: "{{ completed_dir }}/genesis_installed_check" }
    - { path: "{{ completed_dir }}/genesis_packages_installed_check" }
    - { path: "{{ completed_dir }}/javabuildtools" }
    - { path: "{{ completed_dir }}/sametime_installed" }

-
  name: "Setting domino_reset as completed"
  become: true
  when: domino_server_installed.stat.exists
  ansible.builtin.file:
    mode: '0644'
    path: "{{ item.path }}"
    state: "touch"
  with_items:
    - { path: "{{ completed_dir }}/domino_reset" }
