--- - hosts: all tasks: - name: redis | add apt repo apt_repository: repo='deb http://ppa.launchpad.net/chris-lea/redis-server/ubuntu precise main' state=present - name: redis | add apt key apt_key: id=C7917B12 url=http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xB9316A7BC7917B12 state=present - name: redis | install packages apt: pkg=$item state=latest update_cache=true environment: RUNLEVEL: '1' with_items: - redis-server - redis-tools - name: redis | stop redis server service: name=redis-server state=stopped