---

- name: Install base packages
  apt: name={{item}} state=installed
  with_items:
    - build-essential
    - git
    - mercurial
    - zsh
    - tmux
    - vim-nox
    - silversearcher-ag
    - exuberant-ctags
  tags: packages, install

- name: Install GUI packages
  when: gui_enabled
  apt: name={{item}} state=installed
  with_items:
    - lightdm
    - rxvt-unicode-256color
    - i3
    - fonts-dejavu-extra
    - fonts-opensymbol
    - scrot
    - vim-gtk
  tags: packages, install

- name: Set default X session in lightdm
  when: gui_enabled and gui_session
  ini_file:
    dest: /etc/lightdm/lightdm.conf
    section: SeatDefaults
    option: user-session
    value: "{{gui_session}}"
    backup: true
  notify:
  - reload lightdm

- name: Enable and start lightdm
  when: gui_enabled
  service:
    name: lightdm
    enabled: yes
    state: started

- apt_repository:
    repo: "deb http://mozilla.debian.net/ {{ansible_distribution_release}}-backports firefox-release"
  when: ansible_distribution_release != 'NA'
  tags: repos

- apt:
    name: firefox
    state: latest
  tags: packages, install
  when: ansible_distribution_release != 'NA'
