首页 > 解决方案 > 检查引导过程后操作系统是否启动

问题描述

我使用 racadm 命令启动和使用 RHEL7 的新节点

此操作系统启动是其他自动化的一部分(第一步)

我使用 ansible 进行整个自动化,但我现在基本上使用这段代码

- name: Test if the OS is up
  shell: |
    until ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@10.10.10.10 exit; do sleep 30; done
    echo Node node is up!

但这不会在节点启动后立即发生,因为没有用户“用户”我需要一些命令,如 ping 或任何其他方法来测试节点是否启动,任何建议都非常感谢。

标签: linuxshellloopsoperating-system

解决方案


您可以使用 ansiblewait_for_connection模块 - 等待远程系统可访问。请在此处查看文档 https://docs.ansible.com/ansible/latest/modules/wait_for_connection_module.html

该模块利用内部 ansible 传输(和配置)和 ping/win_ping 模块来保证正确的端到端功能


推荐阅读