---
- hosts: all
  tasks:
  - name: Update apt cache it if hasn't been updated within the last day.
    apt: update_cache=yes cache_valid_time=86400
    sudo: yes

  - name: Install Ubuntu packages
    apt: pkg={{ item }}
    sudo: yes
    with_items:
      - vim
      - git

---
- hosts: all
  pre_tasks:
    - name: Update apt cache it if hasn't been updated within the last day
      apt: update_cache=yes cache_valid_time=86400
      sudo: yes

    - name: Install Ubuntu packages
      apt: pkg={{ item }}
      sudo: yes
      with_items:
        - git
  roles:
    - vim
    - bash-aliases

Use new roles in playbook.
Use new roles in playbook.
