---
- hosts: teamcity
  user: vagrant
  tasks:
    - name: update cache
      apt: update_cache=yes
    - name: install curl
      apt: pkg=curl

---
- hosts: teamcity
  user: vagrant
  vars:
    teamcity_user: teamcity
  tasks:
    - name: update cache
      apt: update_cache=yes
    - name: install curl
      apt: pkg=curl

    - name: install java
      apt: pkg=openjdk-7-jre

    - name: create user running teamcity
      user: name={{teamcity_user}} home=/home/{{teamicty_user}}/ shell=/bin/bash comment="User running TeamCity"

Install java and add a teamcity user
Install java and add a teamcity user
