---
- name: "Set gitplaceholder full path"
  set_fact:
    gitplaceholder_path: "{{ lookup('env', 'HOME') }}/.gitplaceholder"

- name: "Stat gitplaceholder"
  stat:
    path: "{{ gitplaceholder_path }}"
  register: gitplaceholder

- name: Touch gitplaceholder
  file:
    path: "{{ gitplaceholder_path }}"
    state: touch
  when: gitplaceholder.stat.exists == False

- name: "Stat git repo"
  stat:
    path: "{{ lookup('env', 'HOME') }}/.git"
  register: git_repo

#FIXME If aborted in the middle of these steps, ansible won't recover on next run:
- name: Init git repo
  command: "git -C {{ lookup('env', 'HOME') }} init"
  when: git_repo.stat.exists == False
- name: Git add gitplaceholder
  command: "git -C {{ lookup('env', 'HOME') }} add .gitplaceholder"
  when: git_repo.stat.exists == False
- name: Initial commit
  command: "git -C {{ lookup('env', 'HOME') }} commit -m init"
  when: git_repo.stat.exists == False
  notify:
    - Add all

---
- name: "Set gitplaceholder full path"
  set_fact:
    gitplaceholder_path: "{{ lookup('env', 'HOME') }}/.gitplaceholder"

- name: "Stat gitplaceholder"
  stat:
    path: "{{ gitplaceholder_path }}"
  register: gitplaceholder

- name: Touch gitplaceholder
  file:
    path: "{{ gitplaceholder_path }}"
    state: touch
  when: gitplaceholder.stat.exists == False

- name: "Stat git repo"
  stat:
    path: "{{ lookup('env', 'HOME') }}/.git"
  register: git_repo

#FIXME If aborted in the middle of these steps, ansible won't recover on next run:
- name: Init git repo
  command: "git -C {{ lookup('env', 'HOME') }} init"
  when: git_repo.stat.exists == False
- name: Git add gitplaceholder
  command: "git -C {{ lookup('env', 'HOME') }} add .gitplaceholder"
  when: git_repo.stat.exists == False
- name: Set e-mail address for git
  command: "git -C {{ lookup('env', 'HOME') }} confemailhome"
  when: git_repo.stat.exists == False
- name: Initial commit
  command: "git -C {{ lookup('env', 'HOME') }} commit -m init"
  when: git_repo.stat.exists == False
  notify:
    - Add all

Set home's git e-mail address.
Set home's git e-mail address.
