Ansible rebootモジュールで対象サーバを再起動するサンプル
環境
Ansible
RHEL8
概要
ansible.builtin.reboot では reboot_timeout オプションでサーバが再起動するまでの最大待機時間を指定できます。
最大待機時間のデフォルトは600秒 です。
使用例
---
- 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: