---

- name: Ensure the system can use the HTTPS transport for APT
  stat: path=/usr/lib/apt/methods/https
  register: apt_https_transport

- name: Install HTTPS transport for APT
  apt: pkg=apt-transport-https state=installed
  when: not apt_https_transport.stat.exists

- name: Enable all repositories in sources.list
  replace: dest=/etc/apt/sources.list regexp='^#\s?deb(.+)http://(.+)/ubuntu(.+)$' replace='deb\1http://\2/ubuntu\3' backup=yes

- name: Ensure that Aptitude repositories are up to date
  apt: update_cache=yes cache_valid_time={{ aptcachetime }}

- name: Install common packages
  apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time={{ aptcachetime }}
  with_items:
    - aptitude
    - axel
    - build-essential
    - bzip2
    - curl
    - diffutils
    - dos2unix
    - ftp-ssl
    - gcc
    - git
    - grep
    - gzip
    - htop
    - httping
    - iftop
    - iotop
    - less
    - make
    - nano
    - nfs-common
    - nmap
    - openssl
    - p7zip
    - pv
    - pwgen
    - rsync
    - smbclient
    - software-properties-common
    - sshfs
    - sshpass
    - tar
    - tmux
    - trash-cli
    - unzip
    - vim
    - wget
    - whois
    - zip

- name: Upgrade installed packages
  apt: upgrade=yes

---

- name: Ensure the system can use the HTTPS transport for APT
  stat: path=/usr/lib/apt/methods/https
  register: apt_https_transport

- name: Install HTTPS transport for APT
  apt: pkg=apt-transport-https state=installed
  when: not apt_https_transport.stat.exists

- name: Enable all repositories in sources.list
  replace: dest=/etc/apt/sources.list regexp='^#\s?deb(.+)http://(.+)/ubuntu(.+)$' replace='deb\1http://\2/ubuntu\3' backup=yes

- name: Ensure that Aptitude repositories are up to date
  apt: update_cache=yes cache_valid_time={{ aptcachetime }}

- name: Install common packages
  apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time={{ aptcachetime }}
  with_items:
    - aptitude
    - axel
    - build-essential
    - bzip2
    - curl
    - diffutils
    - dos2unix
    - ftp-ssl
    - gcc
    - git
    - grep
    - gzip
    - htop
    - httping
    - iftop
    - imagemagick
    - iotop
    - less
    - make
    - nano
    - nfs-common
    - nmap
    - openssl
    - p7zip
    - pv
    - pwgen
    - rar
    - rsync
    - smbclient
    - software-properties-common
    - sshfs
    - sshpass
    - tar
    - tmux
    - trash-cli
    - unzip
    - vim
    - wget
    - whois
    - zip

- name: Upgrade installed packages
  apt: upgrade=yes

Add rar and imagemagick to common role
Add rar and imagemagick to common role
