diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml
index 2c1deecad63c693740a2bce89ef7c7f63aa4c8f2..b4b83f5c7bb081faab189f77afdcd2f8df702c9b 100644
--- a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml
+++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml
@@ -1,19 +1,12 @@
 ---
-###############################################################################################################
-# The playbook does the following:
-#
-#
-# - Runs the command 'show interfaces diagnostics optics {{ interface }} | no-more' and gets the json output
-# - From json output it retrieves the apporpriate metrics for optical levels
-# - Saves the metrics in relevant variable names
-###############################################################################################################
-
 - name: Get Junos attributes for optical levels of interface "{{ item }}"
   when: local_side.iptrunk_side_node.vendor == "juniper"
   block:
     - name: Run Juniper Optical info
       junipernetworks.junos.junos_command:
-        commands: "show interfaces diagnostics optics {{ item.interface_name }} | no-more"
+        commands:
+          # - show interfaces diagnostics optics {{ item.interface_name }} | no-more
+          - show interfaces terse {{ item.interface_name }}
         # display: json
       register: optical_status
 
@@ -21,6 +14,13 @@
       ansible.builtin.debug:
         msg: "{{ optical_status }}"
 
+    - name: Write output to the file
+      ansible.builtin.blockinfile:
+        path: "{{ opt_checks_file }}"
+        marker: "# {mark} --- {{ check | uppper }} check on {{ inventory_hostname }} for {{ item.interface_name }} ---"
+        append_newline: true
+        block: "{{ optical_status }}"
+
 - name: Get Nokia optical levels on port "{{ item.interface_name }}"
   when: local_side.iptrunk_side_node.vendor == "nokia"
   block:
@@ -35,7 +35,7 @@
         content: |
             <global-operations xmlns="urn:nokia.com:sros:ns:yang:sr:oper-global">
               <md-cli-raw-command>
-                <md-cli-input-line>show port {{ connector }} optical</md-cli-input-line>
+              <md-cli-input-line>show port {{ connector }} optical | match "Lane ID" pre-lines 1 post-lines 5</md-cli-input-line>
               </md-cli-raw-command>
             </global-operations>
         display: json
diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml
index cbd64af784887bdad24857f496eac423e367e648..94f1ebebdd8ce327bcf2e7d7fe69f32a58afec5d 100644
--- a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml
+++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml
@@ -3,7 +3,7 @@
 - name: Print the usage
   ansible.builtin.debug:
     msg:
-      - "Allowed checks: 'ping', 'isis'"
+      - "Allowed checks: 'ping', 'isis', 'lacp', 'optical_pre', 'optical_post'"
   when: (check is not defined) or (check not in checks)
 
 - name: Fail if arguments are not correct
@@ -46,7 +46,33 @@
   ansible.builtin.include_tasks: check_trunk_interface.yaml
   when: check == "ping"
 
+- name: Set the optical checks results directory name
+  when: check == "optical_pre" or check == "optical_post"
+  ansible.builtin.set_fact:
+    opt_checks_dir: "/var/tmp/ansible_trunk_checks_{{ trunks[0].id }}"
+
+- name: Set the optical checks results file name
+  when: check == "optical_pre" or check == "optical_post"
+  ansible.builtin.set_fact:
+    opt_checks_file: "{{ opt_checks_dir }}/checks_{{ process_id }}.txt"
+
+- name: Create a folder for the optical check results
+  when: check == "optical_pre" or check == "optical_post"
+  ansible.builtin.file:
+    path: "{{ opt_checks_dir }}"
+    state: directory
+    mode: '0755'
+  delegate_to: localhost
+
+- name: Create file for the optical check results
+  when: check == "optical_pre" or check == "optical_post"
+  ansible.builtin.file:
+    path: "{{ opt_checks_file }}"
+    state: touch
+    mode: '0644'
+  delegate_to: localhost
+
 - name: Check optical levels
+  when: check == "optical_pre" or check == "optical_post"
   ansible.builtin.include_tasks: check_optical_levels.yaml
-  when: check == "optical"
   loop: "{{ local_side.iptrunk_side_ae_members }}"
diff --git a/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml b/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml
index 703b85162c02de0e094a27c07f1098888f603ea5..c19b116ce29fbf598298c3cc9690fe0e3d84427f 100644
--- a/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml
+++ b/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml
@@ -6,7 +6,8 @@ checks:
   - isis
   - ping
   - lacp
-  - optical
+  - optical_pre
+  - optical_post
 
 ping_count: 3
 ping_size: 9000