diff --git a/ansible/bootstrap.yml b/ansible/bootstrap.yml
index 7d8c99480a16ad6866dfe67001a2e13c9ca0fac3..384c6f69f4f65ed17749db7f8217b37355e1f974 100644
--- a/ansible/bootstrap.yml
+++ b/ansible/bootstrap.yml
@@ -6,10 +6,16 @@
   pre_tasks:
     - name: Python predependency
       raw: bash -c "test -e /usr/bin/python" || (sudo apt update && sudo apt install -y  python)
+    - name: Installing other packages
+      apt:
+        state: present
+        name: ['python-pkg-resources', 'python2-pip']
+      when: ansible_distribution_version | float < 20
     - name: Installing other packages
       apt:
         state: present
         name: ['python-pkg-resources', 'python3-pip', 'acl']
+      when: ansible_distribution_version | float > 20
   roles:
     - bootstrap_any
   tags:
diff --git a/ansible/roles/postgresql-data-update-managed/tasks/main.yml b/ansible/roles/postgresql-data-update-managed/tasks/main.yml
index 6be382083fa3bc0886b0ffffcc5ecbe0e84861d8..39d17807fd3aea1b86dd7972ce037e34da3d978f 100644
--- a/ansible/roles/postgresql-data-update-managed/tasks/main.yml
+++ b/ansible/roles/postgresql-data-update-managed/tasks/main.yml
@@ -1,7 +1,14 @@
-- name: install psycopg2
+- name: install python-psycopg2
   package:
     name: python-psycopg2
     state: present
+  when: ansible_distribution_version | float < 20
+
+- name: install python3-psycopg2
+  package:
+    name: python3-psycopg2
+    state: present
+  when: ansible_distribution_version | float > 20
 
 - name: Verifying db users are present else creating them
   include: databases.yml
@@ -58,4 +65,4 @@
     login_host: "{{ uci_postgres_host }}"
     name: "{{ uci_odk_postgres_database }}"
     state: restore
-    target: "/tmp/uci_odk_postgres.sql"
\ No newline at end of file
+    target: "/tmp/uci_odk_postgres.sql"