---
- 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: 0700

- name: Check whether ~/.config and ~/.local/share exist
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  loop:
    - ~/.config
    - ~/.local/share
