---
- hosts: httpbin
tasks:
- name: Paketquelle "stable" entfernen
apt_repository: repo='deb http://mirrors.digitalocean.com/debian jessie main' state=absent
- name: Paketquelle "testing" hinzufügen
apt_repository: repo='deb http://mirrors.digitalocean.com/debian testing main contrib non-free' state=present
- name: Paketverzeichnis aktualisieren
apt: update_cache=yes upgrade=dist
- name: apache2 installieren
apt: pkg=apache2 state=present
- name: mod_wsgi installieren
apt: pkg=libapache2-mod-wsgi state=present
- name: httpbin installieren
apt: pkg=python-httpbin state=present
- name: Verzeichnis /var/www/httpbin erstellen
file: path=/var/www/httpbin state=directory
- name: Benutzer "httpbin" anlegen
user: name=httpbin
- name: WSGI-Starter kopieren
copy: src=httpbin.wsgi dest=/var/www/httpbin/httpbin.wsgi owner=httpbin group=httpbin mode=0644
- name: Apache-Skript kopieren
copy: src=httpbin.conf dest=/etc/apache2/sites-available owner=root group=root mode=0644
- name: voreingestellten virtuellen Host für Apache deaktivieren
command: a2dissite 000-default.conf
- name: neuen virtuellen Host für Apache aktivieren
command: a2ensite httpbin.conf
- name: Apache neustarten
service: name=apache2 state=restarted