Score:0

How to register Ansible actions in Windows Event Log?

ar flag

Ansible: 2.9 Windows: W2k16 Server

I'm searching for a method to register (log) Ansible actions in remote Windows host.

For example, when I work with win_command module for echo test command, I can't find lines referring to this action in Windows Event Log.

How can I make the ansible actions show up in the Windows Event log?

cn flag
What are the specific lines you are expecting, and what lines are produced?
CH06 avatar
ar flag
\_ In to "Windows Events" I like found "Ansible_user launch command: echo test" with stdout: "The result command".
Score:2
ca flag

I understand your question that you like to Register and log Return Values from win_command in Windows Event Log.

You could use win_eventlog_entry – Write entries to Windows event logs and something like

- 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 }}"
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.