---
- name: check | Current user ID
  fail:
    msg: This playbook should not be run as 'root'
  when: ansible_real_user_id == 0

- name: check | 0700 permission on HOME directory
  file:
    path: '{{ ansible_user_dir }}'
    state: directory
    owner: '{{ ansible_user_id }}'
    group: '{{ ansible_user_id }}'
    mode: '700'

- name: check | Whether XDG_CONFIG_HOME and XDG_DATA_HOME exist
  file:
    path: '{{ item }}'
    state: directory
    mode: '755'
  loop:
    - '{{ xdg_dir.config_home }}'
    - '{{ xdg_dir.data_home }}'
