diff --git a/main/ansible/APKBUILD b/main/ansible/APKBUILD
index 00afea0782bf9de678f3b50fc7fcc0d34e55eaa4..517a4058b5453b4edefeb0eb108ccef8e7f5d3a3 100644
--- a/main/ansible/APKBUILD
+++ b/main/ansible/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
 pkgname=ansible
 pkgver=2.0.0.2
-pkgrel=0
+pkgrel=1
 pkgdesc="A configuration-management, deployment, task-execution, and multinode orchestration framework"
 url="http://ansible.com"
 arch="noarch"
@@ -10,9 +10,20 @@ license="GPL3+"
 depends="python py-yaml py-paramiko py-jinja2 py-markupsafe"
 makedepends="python-dev py-setuptools"
 subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::http://releases.ansible.com/ansible/$pkgname-$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::http://releases.ansible.com/ansible/$pkgname-$pkgver.tar.gz
+	iteration-context.patch"
 
 _builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
 build() {
 	cd "$_builddir"
 	python setup.py build || return 1
@@ -38,6 +49,9 @@ package() {
 		"$pkgdir"/usr/share/doc/$pkgname/README.extras.md || return 1
 }
 
-md5sums="816d0c49e084383e47a725c761a0e413  ansible-2.0.0.2.tar.gz"
-sha256sums="27db0b99113fab85b1430c361c7790a0aa7f5c614c9af13362e2adbba07e5828  ansible-2.0.0.2.tar.gz"
-sha512sums="bf034384849d3f065ff77982e2e47a94727fc2982f0dac8d67efda2646dcdbd52ba9cc3ddfcdb9cd8210af0935f6f42946cc8ddc659d62cccd670e5d55c7dfa0  ansible-2.0.0.2.tar.gz"
+md5sums="816d0c49e084383e47a725c761a0e413  ansible-2.0.0.2.tar.gz
+e745fcea8520d23386d238d249742741  iteration-context.patch"
+sha256sums="27db0b99113fab85b1430c361c7790a0aa7f5c614c9af13362e2adbba07e5828  ansible-2.0.0.2.tar.gz
+bc11f3095ea9b00e2855a6969bce3764137f54114f979e519e299a5584dfde62  iteration-context.patch"
+sha512sums="bf034384849d3f065ff77982e2e47a94727fc2982f0dac8d67efda2646dcdbd52ba9cc3ddfcdb9cd8210af0935f6f42946cc8ddc659d62cccd670e5d55c7dfa0  ansible-2.0.0.2.tar.gz
+30cc45a485a1048b3e86dea8fc30b65095326e79c0b16ab4d9ab0c8362ec3cefe352500b215858c2b150b2d9a288d3e9bca05c1354969bb16ade2ad123b3df83  iteration-context.patch"
diff --git a/main/ansible/iteration-context.patch b/main/ansible/iteration-context.patch
new file mode 100644
index 0000000000000000000000000000000000000000..db2ed310423b88d33fee5f9807c4949311a08abd
--- /dev/null
+++ b/main/ansible/iteration-context.patch
@@ -0,0 +1,13 @@
+diff -upr ansible-2.0.0.2.orig/lib/ansible/executor/task_executor.py ansible-2.0.0.2/lib/ansible/executor/task_executor.py
+--- ansible-2.0.0.2.orig/lib/ansible/executor/task_executor.py	2016-02-04 00:51:21.944735819 +0100
++++ ansible-2.0.0.2/lib/ansible/executor/task_executor.py	2016-02-04 00:52:26.688134310 +0100
+@@ -365,6 +365,9 @@ class TaskExecutor:
+         if not self._connection or not getattr(self._connection, 'connected', False):
+             self._connection = self._get_connection(variables=variables, templar=templar)
+             self._connection.set_host_overrides(host=self._host)
++        # If connection is reused, its _play_context is no longer valid and needs to be replaced
++        # This fixes issues with tasks running sudo in a loop and having the success_key incorrect in the second iteration
++        self._connection._play_context = self._play_context
+ 
+         self._handler = self._get_action_handler(connection=self._connection, templar=templar)
+