diff --git a/README.md b/README.md
index c383769a9bafdf8ffa445e1ceef9137273d5bc55..df30a5f8ddf42690e54a62e7b1514d604e2aac88 100644
--- a/README.md
+++ b/README.md
@@ -9,29 +9,7 @@ Ansible role to install [jmasar-service](https://gitlab.esss.lu.se/ics-software/
 
 ## Role Variables
 
-```yaml
----
-jmasar_version: 4.6.6
-# profile should be test or production
-jmasar_profile: test
-jmasar_postgres_tag: 10
-jmasar_postgres_user: jmasar
-jmasar_postgres_password: secret
-jmasar_postgres_db: jmasar
-# Host interface to expose postgres port
-# Hostnames are not allowed! Use 0.0.0.0 to allow access from other machines
-jmasar_postgres_published_interface: 127.0.0.1
-# server_name used in nginx config and jmasar.service (it can't be a list!)
-jmasar_server_name: "{{ ansible_fqdn }}"
-jmasar_epics_ca_addr_list: "localhost"
-jmasar_epics_ca_auto_addr_list: "NO"
-# Parameters for logging
-# If jmasar_graylog_host is empty, logging will be to sdout
-jmasar_graylog_host: 127.0.0.1
-jmasar_graylog_port: 12201
-jmasar_max_body_size: 500M
-
-```
+See: [Default variables](defaults/main.yml)
 
 ## Example Playbook
 
diff --git a/defaults/main.yml b/defaults/main.yml
index bd216786a2e3c2a25bc2daa40714008aab2cd375..2c41c0920de1fd7ef72010e63f1495de41ec9e37 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,14 +1,8 @@
 ---
-jmasar_version: 4.6.6
-# profile should be test or production
-jmasar_profile: test
-jmasar_postgres_tag: 10
-jmasar_postgres_user: jmasar
-jmasar_postgres_password: secret
-jmasar_postgres_db: jmasar
-# Host interface to expose postgres port
-# Hostnames are not allowed! Use 0.0.0.0 to allow access from other machines
-jmasar_postgres_published_interface: 127.0.0.1
+jmasar_version: 4.7.009
+jmasar_elasticsearch_image_name: elasticsearch
+jmasar_elasticsearch_image_tag: 8.2.3
+jmasar_elasticsearch_image: "{{ jmasar_elasticsearch_image_name }}:{{ jmasar_elasticsearch_image_tag }}"
 # server_name used in nginx config and jmasar.service (it can't be a list!)
 jmasar_server_name: "{{ ansible_fqdn }}"
 jmasar_epics_ca_addr_list: "localhost"
diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml
index 008c6f516a9bcb1b3e5b4d22a610f7b7dd3b940b..72b8afd6f663162ec12b931846e5898848ef72b7 100644
--- a/molecule/default/molecule.yml
+++ b/molecule/default/molecule.yml
@@ -22,8 +22,8 @@ driver:
 platforms:
   - name: ics-ans-role-jmasar-default
     box: centos/7
-    memory: 512
-    cpus: 1
+    memory: 2048
+    cpus: 2
     instance_raw_config_args:
       - "vbguest.auto_update = false"
     groups:
diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py
index b6a8fe4684768d6885fd022a7d7354595646c01c..8e59cfd83b3475d0e5a2ced30980765bf3ddd5e9 100644
--- a/molecule/default/tests/test_default.py
+++ b/molecule/default/tests/test_default.py
@@ -13,7 +13,7 @@ def test_service_enabled_and_running(host, name):
     assert service.is_running
 
 
-def test_jmasar_selected_profile(host):
+def test_elasticsearch_running(host):
     with host.sudo():
-        cmd = host.run("journalctl -u jmasar.service")
-    assert "The following profiles are active: test" in cmd.stdout
+        elasticsearch = host.docker("jmasar_elasticsearch")
+        assert elasticsearch.is_running
diff --git a/tasks/main.yml b/tasks/main.yml
index 74ee0175a0dfd5aca73e34d59f171cabd3189f74..2fe21ea0d50aa06fe24d03576ac89304ee694b72 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -17,21 +17,21 @@
     group: jmasar
     mode: 0750
 
-- name: launch postgres container
+- name: launch elasticsearch container
   docker_container:
-    name: jmasar_postgres
-    image: "postgres:{{ jmasar_postgres_tag }}"
+    name: jmasar_elasticsearch
+    image: "{{ jmasar_elasticsearch_image }}"
+    pull: true
     state: started
     restart_policy: always
+    published_ports: 127.0.0.1:9200:9200
     volumes:
-      - "{{ jmasar_postgres_data }}:/var/lib/postgresql/data/pgdata"
-    ports:
-      - "{{ jmasar_postgres_published_interface }}:5432:5432"
-    env:
-      POSTGRES_USER: "{{ jmasar_postgres_user }}"
-      POSTGRES_PASSWORD: "{{ jmasar_postgres_password }}"
-      POSTGRES_DB: "{{ jmasar_postgres_db }}"
-      PGDATA: /var/lib/postgresql/data/pgdata
+      - "jmasar-elasticsearch-data:/usr/share/elasticsearch/data"
+    env: "{{ jmasar_elasticsearch_env }}"
+    ulimits:
+      - "memlock:-1"
+      - "nofile:65536:65536"
+      - "nproc:4096:4096"
 
 - name: install jmasar
   get_url:
@@ -55,6 +55,18 @@
   notify:
     - restart jmasar service
 
+- name: Wait for elasticsearch to start
+  wait_for:
+    port: 9200
+
+- name: Wait for elasticsearch status to be yellow
+  uri:
+    url: http://localhost:9200/_cluster/health?wait_for_status=yellow
+  register: jmasar_elasticsearch_health
+  retries: 20
+  delay: 3
+  until: jmasar_elasticsearch_health.status == 200
+
 - name: enable and start jmasar service
   systemd:
     name: jmasar.service
@@ -83,7 +95,7 @@
 
 - name: check that we can connect to the jmasar service locally
   uri:
-    url: http://localhost:8080/root
+    url: http://localhost:8080/version
   register: jmasar_web_request
   until: jmasar_web_request.status == 200
   retries: 10
@@ -93,7 +105,7 @@
 
 - name: check that we can connect to the jmasar service on port 80
   uri:
-    url: http://{{ jmasar_server_name }}/root
+    url: http://{{ jmasar_server_name }}/version
   register: jmasar_web_request
   until: jmasar_web_request.status == 200
   retries: 10
diff --git a/templates/jmasar.service.j2 b/templates/jmasar.service.j2
index 3e4025e3049fc08bdee3d7f8be0d83fc18d4f89f..45d9826194c9498c8e89c718f9ed9beaf8988602 100644
--- a/templates/jmasar.service.j2
+++ b/templates/jmasar.service.j2
@@ -8,9 +8,9 @@ WorkingDirectory=/opt/jmasar
 Environment='EPICS_CA_ADDR_LIST={{ jmasar_epics_ca_addr_list }}'
 Environment=EPICS_CA_AUTO_ADDR_LIST={{ jmasar_epics_ca_auto_addr_list }}
 {% if jmasar_graylog_host %}
-ExecStart={{ java_openjdk_bin }} -Ddbengine=postgresql -Dspring.datasource.username={{ jmasar_postgres_user }} -Dspring.datasource.password={{ jmasar_postgres_password }} -Dspring.datasource.jdbcUrl=jdbc:postgresql://localhost:5432/{{ jmasar_postgres_db }} -Dspring.profiles.active={{ jmasar_profile }}  -Dhostname={{ jmasar_server_name }} -DGRAYLOG_HOST={{ jmasar_graylog_host }} -DGRAYLOG_PORT={{ jmasar_graylog_port }} -Dlog4j.configurationFile=log4j2-gelf.xml -Dlog4j2.formatMsgNoLookups=true -Djca.use_env=true -jar jmasar-service.jar
+ExecStart={{ java_openjdk_bin }} -DGRAYLOG_HOST={{ jmasar_graylog_host }} -DGRAYLOG_PORT={{ jmasar_graylog_port }} -jar jmasar-service.jar
 {% else %}
-ExecStart={{ java_openjdk_bin }} -Ddbengine=postgresql -Dspring.datasource.username={{ jmasar_postgres_user }} -Dspring.datasource.password={{ jmasar_postgres_password }} -Dspring.datasource.jdbcUrl=jdbc:postgresql://localhost:5432/{{ jmasar_postgres_db }} -Dspring.profiles.active={{ jmasar_profile }}  -Dhostname={{ jmasar_server_name }} -Dlog4j2.formatMsgNoLookups=true -Djca.use_env=true -jar jmasar-service.jar
+ExecStart={{ java_openjdk_bin }} -jar jmasar-service.jar
 {% endif %}
 SuccessExitStatus=143
 Restart=always
diff --git a/vars/main.yml b/vars/main.yml
index 19348aee8752645ce63f7ec0beb08868e60e2f56..9edc3e02930f515f8e432f92781af0b98cd11487 100644
--- a/vars/main.yml
+++ b/vars/main.yml
@@ -1,8 +1,12 @@
 ---
-jmasar_postgres_data: /opt/jmasar/pgdata
 jmasar_required_packages:
   - nginx
 jmasar_local_repo: "{{ 'libs-snapshot-local' if 'SNAPSHOT' in jmasar_version else 'libs-release-local' }}"
 jmasar_url: "https://artifactory.esss.lu.se/artifactory/{{ jmasar_local_repo }}/org/phoebus/service-save-and-restore/{{ jmasar_version }}/service-save-and-restore-{{ jmasar_version }}.jar"
 java_openjdk_version: "11.0.5+10"
 java_install_oracle_jdk8: false
+jmasar_elasticsearch_env:
+  discovery.type: single-node
+  bootstrap.memory_lock: "true"
+  ES_JAVA_OPTS: -Xms512m -Xmx512m
+  xpack.security.enabled: "false"