job/ansible

ansible - windows Win32ErrorCode 1058

시스템엔지니어 2019. 5. 23. 12:08

TASK [Running Windows Update] **********************************************************************************************************
task path: /root/ansible/dhsa/winu.yml:5
win_updates: running win_updates module
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_updates.ps1
<123.123.123.123> ESTABLISH WINRM CONNECTION FOR USER: test01 on PORT 5986 TO 123.123.123.123 
EXEC (via pipeline wrapper)
The full traceback is:
Exception calling "RunAsUser" with "7" argument(s): "Failed to start become pro
cess (The service cannot be started, either because it is disabled or because i
t has no enabled devices associated with it, Win32ErrorCode 1058)"
At line:907 char:9
+         $result = [AnsibleBecome.BecomeUtil]::RunAsUser($username, $password,
 $l ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : Win32Exception
 

fatal: [123.123.123.123  ]: FAILED! => {
    "changed": false, 
    "msg": "Failed to become user SYSTEM: Exception calling \"RunAsUser\" with \"7\" argument(s): \"Failed to start become process (The service cannot be started, either because it is disabled or because it has no enabled devices associated with it, Win32ErrorCode 1058)\""
}
        to retry, use: --limit @/root/ansible/dhsa/winu.retry

PLAY RECAP *****************************************************************************************************************************
123.123.123.123       : ok=0    changed=0    unreachable=0    failed=1    skipped=0  

 

 

윈도우 보안업데이트 하려고 하는데 위와같이 에러 발생

 

이럴경우에는 윈도우 서비스중 secondary logon  서비스가 사용안함으로 돼 있을경우 에러가 난다. 원래는 윈도우 보안업데이트 실행시 이게 종료돼있어도 자동으로 실행되야하는데 아에 사용안함으로 돼 있으니까 에러 난다.

 

secondary logon 이게 원래 디폴트는 사용안함이 아니다. 근데 보안상 취약한 서비스라 사용안함을 권고하고 있다. 

 

대부분 서비스 사용중이라 이런 에러 자체가 없어서 찾느라 드럽게 힘들었다.