본문 바로가기
인프라/앤서블(Ansible)

[ANSIBLE] 윈도우 업데이트 목록 추출하기

by IT맥구리나스 2024. 3. 8.

젠킨스를 통해서 윈도우 업데이트 목록을 추출할 수 있다.

 

- hosts: all
  gather_facts: no
  vars:
     ansible_connection: winrm
     ansible_winrm_server_cert_validation: ignore
     ansible_winrm_scheme: http
     ansible_become: false
     ansible_winrm_transport: basic
     ansible_port: 5985
  tasks:
   - name: windows update list
     win_shell: |
       Get-HotFix | ForEach-Object {
          [PSCustomObject]@{
            FullName = hostname
            HotFixID = $_.HotFixID
            Date = (Get-Date $_.installedon).Tostring("yyyy-MM-dd")
            }
        }
     register: result

   - debug:
       msg: "{{ result.stdout_lines }}"

 

 

반응형

댓글