Execution
Date 03 Apr 2024 08:28:50 +0100
Duration 00:03:05.49
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.2.dev2
Python 3.10.10
Summary
374 Hosts
3 Tasks
875 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/projects/RM9380/RM9380-verify-nfs-servers.yaml

---
- name: Playbook to check if both servers are up or not
  hosts: all
  gather_facts: false
  vars:
    ara_playbook_name: RM9380 verify nfs
    ara_playbook_labels:
      - RM9380
      - jelastic
      - autofs
    save_folder: /home/ssh-gateway/ansible/projects/RM9380
  tasks:
    - name: Run the mount check
      block:
        - name: Check if the host is alive
          ansible.builtin.ping:
            data: "alive"
          register: ping_result
          ignore_errors: false
          changed_when: false
      rescue:
        - name: Save the stopped ones to a file
          when: "'rc' in ping_result"
          ansible.builtin.lineinfile:
            path: "{{ save_folder }}/nfs_servers_down.txt"
            mode: '0640'
            create: true
            line: '{{ src_node }}:{{ dstnodename }}{{ folder }}:{{ dstnodename }}:{{ folder }}'
          delegate_to: 127.0.0.1
      always:
        - name: Print all ok
          when: "'alive' in ping_result"
          ansible.builtin.debug:
            msg: "All ok"