From 105ff7a9a7e8a5baa2db80bf7f21e54026c02ce2 Mon Sep 17 00:00:00 2001 From: sinihabe <35365304+sinihabe@users.noreply.github.com> Date: Thu, 23 Feb 2023 22:39:53 +0200 Subject: [PATCH] Wait before grabbing logfile This waits for gophish to start, before grabbing logfile. If the wait is missing, it grabs logfile before password is written to the file. --- ansible-playbook/roles/gophish/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible-playbook/roles/gophish/tasks/main.yml b/ansible-playbook/roles/gophish/tasks/main.yml index 5cf3e801..1f8e2e0b 100644 --- a/ansible-playbook/roles/gophish/tasks/main.yml +++ b/ansible-playbook/roles/gophish/tasks/main.yml @@ -213,6 +213,11 @@ state: reloaded enabled: yes +- name: Wait for gophish to start + ansible.builtin.wait_for: + path: /opt/gophish/gophish.log + search_regex: "Starting admin server" + - name: get Gophish log file which contain initial password command: cat /home/{{ gophish_user }}/gophish_deploy/gophish.log register: gophish_log