diff --git a/defaults/main.yml b/defaults/main.yml
index 3eb69d5..40ef5f5 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -10,8 +10,8 @@ sympa_template_lists: []
 #  bouncequeue_transport: sympabounce
 
 ## Database variables
-sympa_db_type: mysql             # mysql or pgsql
-sympa_install_db_package: false  # yes for this role to install mysql or postgres, no if installed elsewhere / TODO: not yet working for MySQL
+sympa_db_type: mysql             # mysql or PostgreSQL
+sympa_install_db_package: false  # yes for this role to install mysql or postgres, no if installed elsewhere 
 sympa_db_name: sympa
 sympa_db_host: localhost
 sympa_db_port: 3306
diff --git a/tasks/main.yml b/tasks/main.yml
index fdd061b..b549aff 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -7,7 +7,7 @@
 
 - name: PostgreSQL configuration
   include_tasks: postgresql.yml
-  when: sympa_db_type == 'pgsql'
+  when: sympa_db_type == 'PostgreSQL'
 
 - name: Set debconf options for sympa
   debconf:
@@ -16,10 +16,20 @@
     value: "{{ item.value }}"
     vtype: "{{ item.vtype }}"
   loop:
+      ## set the database type
   - { name: 'sympa', question: 'sympa/database-type', value: '{{ sympa_db_type }}' , vtype: select }
+      ## Configure the database at sympa installation with dbconfig
   - { name: 'sympa', question: 'sympa/dbconfig-install', value: 'true' , vtype: boolean }
+      ## Set the sympa database name
+  - { name: 'sympa', question: 'sympa/db/dbname', value: '{{ sympa_db_name }}' , vtype: string }
+      ## Set the sympa database user
+  - { name: 'sympa', question: 'sympa/db/app-user', value: '{{ sympa_db_user }}' , vtype: string }
+      ## Use the localhost for database (and not a distant host to define)
+  - { name: 'sympa', question: 'sympa/remote/host', value: 'localhost' , vtype: select }
+      ## Set the webserver type
   - { name: 'sympa', question: 'wwsympa/webserver_type', value: '{{ sympa_webserver_type }}' , vtype: select }
 
+
 - name: Create sympa dir
   file:
     path: "/etc/sympa/sympa"
diff --git a/tasks/mysql.yml b/tasks/mysql.yml
index 66cf1a9..56393e2 100644
--- a/tasks/mysql.yml
+++ b/tasks/mysql.yml
@@ -1,7 +1,7 @@
 ---
 ## MySQL configuration for sympa
 
-- name: check mysql installation
+- name: check MySQL installation
   block: 
   - name: Gather installed packages
     package_facts:
@@ -18,7 +18,6 @@
       success_msg: "MySQL package found. We can continue!"
   when: not sympa_install_db_package
 
-## TODO: minimal installation of MySQL for sympa. This single task is not enough
 - name: Install MySQL packages 
   apt: 
     name: 
diff --git a/tasks/postgresql.yml b/tasks/postgresql.yml
index 07ff1fe..fe87031 100644
--- a/tasks/postgresql.yml
+++ b/tasks/postgresql.yml
@@ -1,4 +1,65 @@
 ---
-## PostgreSQL configuration for sympa
+## PostgreSQL installation and configuration for sympa
 
+- name: check PostgreSQL installation
+  block: 
+  - name: Gather installed packages
+    package_facts:
+      manager: auto
+
+  - name: check if postgres is installed
+    assert:
+      that: ansible_facts.packages['postgresql'] is defined
+      fail_msg: "No PostgreSQL pachage found. We stop, because we can't install sympa without its database. Sorry."
+      success_msg: "PostgreSQL package found. We can continue!"
+  when: not sympa_install_db_package
+
+- name: Install PostgreSQL
+  apt:
+    state: present
+    update_cache: yes
+    cache_valid_time: 3600
+    name:
+      - postgresql
+      - postgresql-contrib
+      - libpq-dev
+      - python-psycopg2
+      - dbconfig-pgsql
+  when: sympa_install_db_package
+  tags: postgresql
+
+- name: Create sympa database
+  become: true
+  become_user: postgres
+  postgresql_db:
+    name: "{{ sympa_db_name }}"
+    encoding: UTF-8
+    lc_collate: es_UY.UTF-8
+    lc_ctype: es_UY.UTF-8
+    template: template0
+    state: present
+  tags: postgresql
+
+- name: Create sympa user with access to the database
+  become: true
+  become_user: postgres
+  postgresql_user:
+    db: "{{ sympa_db_name }}"
+    name: "{{ sympa_db_user }}"
+    password: "{{ sympa_db_password | mandatory }}"
+    priv: ALL
+    state: present
+  tags: postgresql
+
+## Debconf keys for sympa database
+
+- name: Definir opciones debconf de sympa, relativas a la base PostgreSQL
+  debconf:
+    name: "{{ item.name }}"
+    question: "{{ item.question }}"
+    value: "{{ item.value }}"
+    vtype: "{{ item.vtype }}"
+  loop:
+      ## Set the sympa database password
+  - { name: 'sympa', question: 'sympa/pgsql/app-pass', value: '{{ sympa_db_password | mandatory }}' , vtype: password }
 ...
diff --git a/templates/sympa.conf.j2 b/templates/sympa.conf.j2
index 3dea6f0..95f64b9 100644
--- a/templates/sympa.conf.j2
+++ b/templates/sympa.conf.j2
@@ -283,7 +283,7 @@ parsed_family_files	{{ sympa_parsed_family_files }}
 ## db_type
 ## Type of the database (mysql|Pg|Oracle|Sybase|SQLite)
 ## Be careful to the case
-db_type	mysql
+db_type	{{ sympa_db_type }}
 
 ## db_name
 ## Name of the database