with_items: packages_to_upgrade
   when: packages_to_upgrade|length > 0
 
+- name: Upgrade non aarch64 packages
+  apt:
+    name: "{{ item }}"
+    state: latest
+    force: yes
+  with_items: non_aarch64_packages_to_upgrade
+  when:
+    non_aarch64_packages_to_upgrade|length > 0 and
+    ansible_architecture != "aarch64"
+
 - name: Install packages
   apt:
     name: "{{ item }}"
   with_items: packages|list + common_packages|list
   when: packages|length > 0 or
         common_packages|length > 0
+
+- name: Install non aarch64 packages
+  apt:
+    name: "{{ item }}"
+    state: present
+  with_items: non_aarch64_packages|list + non_aarch64_common_packages|list
+  when: ansible_architecture != "aarch64"
 
     group: root
     mode: 0644
   register: sources
+  when: ansible_architecture != "aarch64"
 
 - name: Install apt keys
   apt_key:
     mode: 0644
   with_items: apt_repos|list + common_apt_repos|list
   register: local_apt_repos
+  when: ansible_architecture != "aarch64"
 
 - include: setup-ubuntu.yml
   when: ansible_distribution == "Ubuntu"
 
+- include: setup-ubuntu-non-aarch64.yml
+  when:
+    ansible_distribution == "Ubuntu" and
+    ansible_architecture != "aarch64"
+
 # configure debian specific things
 - include: setup-debian.yml
   when: ansible_distribution == "Debian"
 
--- /dev/null
+---
+- name: Upload weekly kernel-clean crontab.
+  template:
+    src: cron/kernel-clean
+    dest: /etc/cron.weekly/kernel-clean
+    owner: root
+    group: root
+    mode: 0755
+  notify:
+    - restart cron
+
+- name: Upload /etc/grub.d/02_force_timeout.
+  template:
+    src: grub.d/02_force_timeout
+    dest: /etc/grub.d/02_force_timeout
+    owner: root
+    group: root
+    mode: 0755
+
+- name: Enable kernel logging to console.
+  script: scripts/kernel_logging.sh creates=/kernel-logging-setup
+  register: kernel_logging
+  tags:
+    - kernel_logging
+
+- name: Update grub
+  command: update-grub
+  when: kernel_logging|changed
+  tags:
+    - kernel_logging
+
+- name: Upload ttyS1.conf.
+  template:
+    src: ttyS1.conf
+    dest: /etc/init/ttyS1.conf
+    owner: root
+    group: root
+    mode: 0644
+  notify:
+    - start ttyS1
+
+# this only runs on mira nodes
+- name: Upload ttyS2.conf.
+  template:
+    src: ttyS2.conf
+    dest: /etc/init/ttyS2.conf
+    owner: root
+    group: root
+    mode: 0644
+  notify:
+    - start ttyS2
+  when: ansible_hostname | search("^mira*")
+
+- name: Enable kernel modules to load at boot time.
+  template:
+    src: modules
+    dest: /etc/modules
+    owner: root
+    group: root
+    mode: 0644
+
+- name: Enabling auto-fsck fix to prevent boot hangup.
+  lineinfile:
+    dest: /etc/default/rcS
+    line: "FSCKFIX=yes"
+    regexp: "FSCKFIX=no"
+    # backrefs makes it so that if the regexp
+    # isn't found the file is left unchanged
+    backrefs: yes
+    state: present
 
     path: /etc/ceph
     state: absent
 
-- name: Upload weekly kernel-clean crontab.
-  template:
-    src: cron/kernel-clean
-    dest: /etc/cron.weekly/kernel-clean
-    owner: root
-    group: root
-    mode: 0755
-  notify:
-    - restart cron
-
 # Install and configure cpan and Amazon::S3
 - include: cpan.yml
   tags:
     - cpan
 
-- name: Upload /etc/grub.d/02_force_timeout.
-  template:
-    src: grub.d/02_force_timeout
-    dest: /etc/grub.d/02_force_timeout
-    owner: root
-    group: root
-    mode: 0755
-
-- name: Enable kernel logging to console.
-  script: scripts/kernel_logging.sh creates=/kernel-logging-setup
-  register: kernel_logging
-  tags:
-    - kernel_logging
-
-- name: Update grub
-  command: update-grub
-  when: kernel_logging|changed
-  tags:
-    - kernel_logging
-
-- name: Upload ttyS1.conf.
-  template:
-    src: ttyS1.conf
-    dest: /etc/init/ttyS1.conf
-    owner: root
-    group: root
-    mode: 0644
-  notify:
-    - start ttyS1
-
-# this only runs on mira nodes
-- name: Upload ttyS2.conf.
-  template:
-    src: ttyS2.conf
-    dest: /etc/init/ttyS2.conf
-    owner: root
-    group: root
-    mode: 0644
-  notify:
-    - start ttyS2
-  when: ansible_hostname | search("^mira*")
-
-- name: Enable kernel modules to load at boot time.
-  template:
-    src: modules
-    dest: /etc/modules
-    owner: root
-    group: root
-    mode: 0644
-
-- name: Enabling auto-fsck fix to prevent boot hangup.
-  lineinfile:
-    dest: /etc/default/rcS
-    line: "FSCKFIX=yes"
-    regexp: "FSCKFIX=no"
-    # backrefs makes it so that if the regexp
-    # isn't found the file is left unchanged
-    backrefs: yes
-    state: present
-
 - include: nfs.yml
   tags:
     - nfs
 
   - python-gevent
   # for running ceph
   - libedit2
-  - libssl0.9.8
   - cryptsetup-bin
   - xfsprogs
   - gdisk
   - parted
   ###
   # for setting BIOS settings
-  - smbios-utils
   ###
   - libcrypto++9
   - libuuid1
-  - libfcgi
   - btrfs-tools
   # for compiling helpers and such
   - libatomic-ops-dev
   - attr
   - dbench
   - bonnie++
-  - iozone3
   - valgrind
   - python-nose
   - mpich2
   - libacl1-dev
   - bc
   - xfsdump
-  - dmapi
   - xfslibs-dev
   - libattr1-dev
   - quota
   - libncurses5-dev
   - lvm2
   ###
-  - sysprof
   - vim
   - pdsh
   - collectl
   - nfs-common
   - nfs-kernel-server
 
+non_aarch64_common_packages:
+  - libssl0.9.8
+  - smbios-utils
+  - libfcgi
+  - iozone3
+  - dmapi
+  - sysprof
+
 packages_to_upgrade:
   - apt
   - apache2
+
+non_aarch64_packages_to_upgrade:
   - libapache2-mod-fastcgi
 
 packages_to_remove:
 
 #  - "deb [arch=amd64] http://{{ mirror_host }}/blkin/ trusty main"
 
 packages:
-  - libgoogle-perftools4
   - libboost-thread1.54.0
   - mpich
   - qemu-system-x86
 #  - blkin
   - lttng-tools
+
+non_aarch64_packages:
+  - libgoogle-perftools4