---
# home.yml tasks

- name: home - check git dir existance
  stat: 
    path: "{{ home_dir }}"
  register: home_git_dir

- name: home - git clone (only if absent, touch yubikey for ssh key unlock)
  git:
    repo: git@github.com:bryfry/home.git
    dest: "{{ home_dir }}"
    accept_hostkey: True
  when: not home_git_dir.stat.exists

- name: home - symbolic links
  file:
    src: "{{ home_dir }}/{{ item }}" 
    dest: "{{ ansible_env.HOME }}/.{{ item }}"
    state: link
    force: yes
  with_items:
  - vimrc
  - tmux.conf
  - tmux.statusbar.conf
  - bashrc
  - bash_aliases

- name: home - create elinks config dir
  file: 
    path: "{{ ansible_env.HOME }}/.elinks"
    state: directory

- name: home - symbolic links (ssh config)
  file:
    src: "{{ home_dir }}/ssh_config" 
    dest: "{{ ansible_env.HOME }}/.ssh/config"
    state: link
    force: yes

- name: home - symbolic links (elinks)
  file:
    src: "{{ home_dir }}/elinks.conf" 
    dest: "{{ ansible_env.HOME }}/.elinks/elinks.conf"
    state: link
    force: yes
