Ansible rebootモジュールで対象サーバを再起動するサンプル

環境
Ansible
RHEL8

概要
ansible.builtin.reboot では reboot_timeout オプションでサーバが再起動するまでの最大待機時間を指定できます。
最大待機時間のデフォルトは600秒 です。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
---
- hosts: servers
tasks:
- name: Reboot
ansible.builtin.reboot: reboot_timeout=600
become: true
- name: Ping Connection
ansible.builtin.ping:
--- - hosts: servers tasks: - name: Reboot ansible.builtin.reboot: reboot_timeout=600 become: true - name: Ping Connection ansible.builtin.ping:
---
- hosts: servers
  tasks:
  - name: Reboot
    ansible.builtin.reboot: reboot_timeout=600
    become: true

  - name: Ping Connection
    ansible.builtin.ping:

 

Ansible

Posted by arkgame