--- - name: Diagnose and fix Nomad service on ch4 hosts: ch4 become: yes tasks: - name: Check Nomad service status systemd: name: nomad state: started register: nomad_status - name: Check Nomad configuration command: nomad version register: nomad_version ignore_errors: yes - name: Check Nomad logs for errors command: journalctl -u nomad --no-pager -n 20 register: nomad_logs ignore_errors: yes - name: Display Nomad logs debug: var: nomad_logs.stdout_lines - name: Check if nomad.hcl exists stat: path: /etc/nomad.d/nomad.hcl register: nomad_config - name: Display nomad.hcl content if exists slurp: src: /etc/nomad.d/nomad.hcl register: nomad_config_content when: nomad_config.stat.exists - name: Show nomad.hcl content debug: msg: "{{ nomad_config_content.content | b64decode }}" when: nomad_config.stat.exists