---
- name:           Domain
  debug:          var=domain

- name:           Stage
  debug:          var=stage

- name:           New Hostname
  debug:          var=new_hostname

- name:           Update apt cache
  apt:            update_cache=yes cache_valid_time="{{ 60 * 60 * 24 }}"
  sudo:           yes

- name:           Autoremove unused packages
  shell:          DEBIAN_FRONTEND=noninteractive apt-get -y autoremove
  sudo:           yes

- name:           Install common packages
  apt:            pkg={{ item }} state=present
  with_items:     common_packages
  sudo:           yes

- name:           Update `hostname`
  hostname:       name="{{ new_hostname }}"
  sudo:           yes
  when:           old_hostname != new_hostname

- name:           Update /etc/hosts
  replace:        dest=/etc/hosts backup=yes regexp={{ old_hostname | replace(".", "[.]") }} replace={{ new_hostname }}
  sudo:           yes
  when:           old_hostname != new_hostname

- name:           Configure logrotate for evolution logs
  copy:           src=logrotate dest=/etc/logrotate.d/evolution mode=0644
  sudo:           yes

- include:        swap.yml
  when:           ansible_swaptotal_mb == 0

---
- name:           Domain
  debug:          var=domain

- name:           Stage
  debug:          var=stage

- name:           New Hostname
  debug:          var=new_hostname

- name:           Update apt cache
  apt:            update_cache=yes cache_valid_time="{{ 60 * 60 * 24 }}"
  sudo:           yes

- name:           Autoremove unused packages
  shell:          DEBIAN_FRONTEND=noninteractive apt-get -y autoremove
  sudo:           yes

- name:           Install common packages
  apt:            pkg={{ item }} state=present
  with_items:     common_packages
  sudo:           yes

- name:           Update `hostname`
  hostname:       name="{{ new_hostname }}"
  sudo:           yes
  when:           old_hostname != new_hostname

- name:           Update /etc/hosts
  replace:        dest=/etc/hosts backup=yes regexp={{ old_hostname | replace(".", "[.]") }} replace={{ new_hostname }}
  sudo:           yes
  when:           old_hostname != new_hostname

- name:           Configure logrotate for evolution logs
  copy:           src=logrotate dest=/etc/logrotate.d/evolution mode=0644
  sudo:           yes

- name:           Test for git protocol (git://) connectivity
  command:        curl -v -m 10 http://github.com:9418/
  register:       git_protocol_test
  ignore_errors:  true

- name:           Bypass git protocol if necessary
  command:        git config --global url."https://".insteadOf git://
  when:           "'connect() timed out' in git_protocol_test.stderr"

- include:        swap.yml
  when:           ansible_swaptotal_mb == 0

Test for, and bypass as necessary, git protocol (eg, for bower)
Test for, and bypass as necessary, git protocol (eg, for bower)
