
앤서블: 2.9 윈도우: W2k16 서버
원격 Windows 호스트에 Ansible 액션을 등록(로그)하는 방법을 찾고 있습니다.
win_command
예를 들어, 명령 모듈 로 작업할 때 echo test
Windows 이벤트 로그에서 이 작업을 참조하는 줄을 찾을 수 없습니다.
Windows 이벤트 로그에 Ansible 작업을 표시하려면 어떻게 해야 합니까?
답변1
나는 당신이 좋아하는 질문을 이해합니다등록하다그리고 로그반환 값~에서win_command
Windows 이벤트 로그에서.
당신은 사용할 수 있습니다win_eventlog_entry
– Windows 이벤트 로그에 항목 쓰기그리고 뭔가
- name: Save the result of 'whoami' in 'result'
ansible.windows.win_command: whoami
register: result
- name: Write 'result.stdout' to Windows Event Log
community.windows.win_eventlog_entry:
log: Result of win_command
source: Ansible module win_command
event_id: 1234
message: "{{ result.stdout }}"