---

- name: Install dotfiles dependencies with APT
  apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time={{ aptcachetime }}
  with_items:
    - pwgen
    - imagemagick
    - libav-tools
    - cowsay
    - fortune

- name: Install dotfiles dependencies with Python PIP
  pip: name={{ item }} state=latest
  with_items:
    - httpie
    - Pygments

- name: Create public dotfiles directory
  file: path="{{ ansible_env.HOME }}/dotfiles/public" state=directory
  register: public_dotfiles_create

- name: Clone public dotfiles repository
  git: repo=https://github.com/Benoth/dotfiles.git dest="{{ ansible_env.HOME }}/dotfiles/public" update=yes accept_hostkey=yes

- name: Configure repository
  command: git config --local user.email "benoth83@gmail.com"
  args:
    chdir: "{{ ansible_env.HOME }}/dotfiles/public"
  when: public_dotfiles_create.changed

- name: Configure repository
  command: git config --local user.name "Benoth"
  args:
    chdir: "{{ ansible_env.HOME }}/dotfiles/public"
  when: public_dotfiles_create.changed

- name: Create private dotfiles directory
  file: path="{{ ansible_env.HOME }}/dotfiles/private" state=directory

---

- name: Install dotfiles dependencies with APT
  apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time={{ aptcachetime }}
  with_items:
    - pwgen
    - imagemagick
    - libav-tools
    - cowsay
    - fortune

- name: Install dotfiles dependencies with Python PIP
  pip: name={{ item }} state=latest
  with_items:
    - httpie
    - Pygments

- name: Create public dotfiles directory
  file: path="{{ ansible_env.HOME }}/dotfiles/public" state=directory
  register: public_dotfiles_create

- name: Clone public dotfiles repository
  git: repo=https://github.com/Benoth/dotfiles.git dest="{{ ansible_env.HOME }}/dotfiles/public" update=yes accept_hostkey=yes

- name: Configure repository
  command: git config --local user.email "benoth83@gmail.com"
  args:
    chdir: "{{ ansible_env.HOME }}/dotfiles/public"
    warn: false
  when: public_dotfiles_create.changed

- name: Configure repository
  command: git config --local user.name "Benoth"
  args:
    chdir: "{{ ansible_env.HOME }}/dotfiles/public"
    warn: false
  when: public_dotfiles_create.changed

- name: Create private dotfiles directory
  file: path="{{ ansible_env.HOME }}/dotfiles/private" state=directory

- name: Fix dotfiles directory owner
  file: path="{{ ansible_env.HOME }}/dotfiles" owner="{{ ansible_env.USER }}" group="{{ ansible_env.USER }}" recurse=yes


Fix dotfiles role (owner + wan)
Fix dotfiles role (owner + wan)
