LoginSignup
1
1

More than 3 years have passed since last update.

AWS上のWindowsServerに対して、ローカルmacからansibleを実行 #4 windows update用のplaybook

Posted at

windows update用のplaybook。
マニュアルは、https://docs.ansible.com/ansible/latest/modules/win_updates_module.html

windowsUpdate.yml
---
- hosts:
  - windows  # インベントリファイルで指定した名前

  tasks: 
  - name: windows update
    win_updates: 
        # blacklist:  # パッチ適用除外リスト。今回は使わない。
        # category_names:  # パッチのカテゴリ。デフォルトのままでよい。
        log_path: c:\ansible_wu.log  # ログ出力先
        reboot:  yes  # 再起動するかどうか。
        # reboot_timeout:  # 再起動タイムアウト。デフォルトのままでよい。
        # server_selection:  # パッチ配信先サーバの指定。デフォルトのままでよい。
        # state:  # パッチを探すだけにするか、適用するか。デフォルトのままでよい。
        # use_scheduled_task:  # 即時適用ではなく、スケジューリングするかどうか。デフォルト。
        # whitelist:  # パッチ適用リスト。今回は使わない。

必須パラメータはないが、log_pathとrebootくらいは指定しておいたほうがいいかな。
あとは環境次第。WSUSありとか。

以下コマンドで実行。
ansible-playbook -i ./ansible/hosts ./ansible/windowsUpdate.yml

コマンド実行結果

PLAY [windows] ************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************
ok: [ホスト名]

TASK [windows update] *****************************************************************************************************************
changed: [ホスト名]

PLAY RECAP ****************************************************************************************************************************
ホスト名 : ok=2    changed=1    unreachable=0    failed=0

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1