#目次
1.ファイルコピー(managedノード→managedノード)
2.ファイルコピー(controlノード→managedノード)
3.ホスト名変更
4.ユーザ作成
5.ユーザリスト表示
6.Windows資格情報追加(ファイルサーバなどの資格情報を追加する)
7.Windows資格情報追加(ファイルサーバなどの資格情報を削除する)
8.タスクスケジューラ削除
9.サービス状態チェック
ファイルコピー(managedノード to managedノード)
---
# ■処理概要
# Managedノード(windows)のファイルを同一Managedノード(windows)にコピーする。
# コピー元ファイルは、src_fileに指定する。
# コピー先ファイルは、dest_fileに指定する。
# 指定方法は以下の2種類から選択する。
# (1) awxのテンプレートの"追加変数"に以下の形式で指定
# loop_vars:
# - src_file: C:\temp\test1.txt
# dest_file: C:\temp\test3.txt
# - src_file: C:\temp\test1.txt
# dest_file: C:\temp\test4.txt
# (2) 本ファイル内に指定(通常はコメントアウト)
#
- name: win_mod_file_copy_remote
hosts: windows
gather_facts: false
tasks:
- name: file_copy
win_copy:
src: "{{ item.src_file }}"
dest: "{{ item.dest_file }}"
remote_src: yes
backup: yes
with_items: "{{ loop_vars }}"
- name: file_check
win_stat:
path: "{{ item.dest_file }}"
register: file_info
with_items: "{{ loop_vars }}"
# 本ファイル内にsrc_file、dest_fileを指定する場合は以下の行のコメントアウトを解除する。
# vars:
# loop_vars:
# - src_file: C:\temp\test1.txt
# dest_file: C:\temp\test5.txt
# - src_file: C:\temp\test1.txt
# dest_file: C:\temp\test6.txt
ファイルコピー(controlノード to managedノード)
---
# ■処理概要
# Controlノード(Ansibleサーバ)の複数のファイルをManagedノード(windows)にコピーする。
# コピー元ファイルは、src_fileに指定する。
# コピー先ファイルは、dest_fileに指定する。
# 指定方法は以下の2種類から選択する。
# (1) awxのテンプレートの"追加変数"に以下の形式で指定
# loop_vars:
# - src_file: /tmp/test1.txt
# dest_file: C:\temp\test1.txt
# - src_file: /tmp/test2.txt
# dest_file: C:\temp\test2.txt
# (2) 本ファイル内に指定(通常はコメントアウト)
#
# ■注意事項
# awxから実行する場合は、Ansibleサーバはコンテナ(awx_task)となる。
# コンテナ(awx_task)内にあらかじめファイルを配置しておく必要あり。
# コマンド例;docker cp /tmp/test.txt awx_task:/tmp/.
- name: win_mod_file_copy
hosts: windows
gather_facts: false
tasks:
- name: file_copy
win_copy:
src: "{{ item.src_file }}"
dest: "{{ item.dest_file }}"
backup: yes
with_items: "{{ loop_vars }}"
- name: file_check
win_stat:
path: "{{ item.dest_file }}"
register: file_info
with_items: "{{ loop_vars }}"
# 本ファイル内にsrc_file、dest_fileを指定する場合は以下の行のコメントアウトを解除する。
# vars:
# loop_vars:
# - src_file: /tmp/test1.txt
# dest_file: C:\temp\test1.txt
# - src_file: /tmp/test2.txt
# dest_file: C:\temp\test2.txt
ホスト名変更
---
# ■処理概要
# Managedノード(windows)のホスト名を変更する。
# ホスト名は、hostnameに指定する。
# 指定方法は以下の2種類から選択する。
# (1) awxのインベントリ(ホスト)の"変数"に以下の形式で指定
# hostname: ansiblehost
# ※CLIからホストの変数を登録する場合は以下コマンド
# 例: awx hosts modify 192.168.1.212 --variables "hostname: host212"
- name: win_mod_hostname_change
hosts: windows
gather_facts: True
tasks:
- name: check_hostname
debug:
msg: "{{ ansible_hostname }}"
- name: change_hostname
win_hostname:
name: "{{ hostname }}"
register: res
- name: reboot
win_reboot:
when: res.reboot_required
- name: check_hostname
debug:
msg: "{{ ansible_hostname }}"
# 本ファイル内にhostnameを指定する場合は以下の行のコメントアウトを解除する。ただし全host同じホスト名になる。
# vars:
# hostname: ansiblehost
ユーザ作成
---
# ■処理概要
# Managedノード(windows)にユーザを作成する。
# 作成に必要な情報の指定方法は以下の2種類から選択する。
# (1) awxのテンプレートの"追加変数"に以下の形式で指定
# loop_vars:
# - local_username: user01
# local_password: P@ssword123
# pw_never_expire: yes
# group1: Administrators
# group2: Users
# - local_username: user02
# local_password: P@ssword123
# pw_never_expire: yes
# group1: Administrators
# group2: Users
# (2) 本ファイル内に指定(通常はコメントアウト)
- name: win_mod_user_create
hosts: windows
gather_facts: False
tasks:
- name: create_user
win_user:
name: "{{ item.local_username }}"
password: "{{ item.local_password }}"
password_never_expires: '{{ item.pw_never_expire }}'
state: present
groups:
- "{{ item.group1 }}"
- "{{ item.group2 }}"
with_items: "{{ loop_vars }}"
- name: show_userlist
win_shell: Get-WmiObject Win32_UserAccount | ? { $_.LocalAccount -eq $true }
register: result
- debug:
msg: "{{ result.stdout_lines | list }}"
# 本ファイル内にユーザ情報を指定する場合は以下の行のコメントアウトを解除する。
# vars:
# loop_vars:
# - local_username: user03
# local_password: P@ssword123
# pw_never_expire: yes
# group1: Administrators
# group2: Users
# - local_username: user04
# local_password: P@ssword123
# pw_never_expire: yes
# group1: Administrators
# group2: Users
ユーザリスト表示
---
# ■処理概要
# Managedノード(windows)のユーザリストを表示する。
- name: win_ref_userlist
hosts: windows
gather_facts: false
tasks:
- name: get userlist
#win_shell: Get-WmiObject Win32_UserAccount | ? { $_.LocalAccount -eq $true } | Format-table -Property Caption,Domain #ローカルユーザのみを表示させる場合はこちら
win_shell: Get-WmiObject Win32_UserAccount | Format-table -Property Caption,Domain
register: result
- debug:
msg: "{{ result.stdout_lines | list}}" # stdout => stdout_lines
Windows資格情報追加(ファイルサーバなどの資格情報を追加する)
---
# ■処理概要
# Managedノード(windows)にWindows資格情報を追加する。
# ※実体は、資格情報追加コマンドを実行するタスクスケジューラを作成し実行する。
# 資格情報の作成に必要な情報の指定方法は以下の2種類から選択する。
# (1) awxのテンプレートの"追加変数"に以下の形式で指定
# cre_name: 192.168.1.111
# cre_user: fileserveruser01
# cre_pass: fileserverpass01
# task_name: add_windows_credential
# task_user: pcmaster
# (2) 本ファイル内に指定(通常はコメントアウト)
#
- name: win_mod_win_credential_add.yml
hosts: windows
gather_facts: false
# vars:
# cre_name: 192.168.1.111
# cre_user: fileserveruser01
# cre_pass: fileserverpass01
# task_name: add_windows_credential
# task_user: pcmaster
tasks:
- name: delete task_scheduled
win_scheduled_task:
name: "{{ task_name }}"
state: absent
- name: add_windows_credential
win_scheduled_task:
name: "{{ task_name }}"
username: "{{ task_user }}"
actions:
- path: 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
arguments: cmdkey /add:{{ cre_name }} /user:{{ cre_user }} /pass:{{ cre_pass }}
triggers:
- type: registration
- name: Wait for the scheduled task to complete
win_scheduled_task_stat:
name: "{{ task_name }}"
register: task_stat
until: (task_stat.state is defined and task_stat.state.status != "TASK_STATE_RUNNING") or (task_stat.task_exists == False)
retries: 7
delay: 5
- name: delete task_scheduled
win_scheduled_task:
name: "{{ task_name }}"
state: absent
Windows資格情報削除(ファイルサーバなどの資格情報を削除する)
---
# ■処理概要
# Managedノード(windows)のWindows資格情報を削除する。
# ※実体は、資格情報削除コマンドを実行するタスクスケジューラを作成し実行する。
# 資格情報の作成に必要な情報の指定方法は以下の2種類から選択する。
# (1) awxのテンプレートの"追加変数"に以下の形式で指定
# cre_name: 192.168.1.111
# task_name: delete_windows_credential
# task_user: pcmaster
# (2) 本ファイル内に指定(通常はコメントアウト)
- name: win_mod_win_credential_delete.yml
hosts: windows
gather_facts: false
# vars:
# cre_name: 192.168.1.111
# task_name: delete_windows_credential
# task_user: pcmaster
tasks:
- name: delete task_scheduled
win_scheduled_task:
name: "{{ task_name }}"
state: absent
- name: win_mod_win_credential_delete
win_scheduled_task:
name: delete_windows_credential
username: "{{ task_user }}"
actions:
- path: 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
arguments: cmdkey /delete:{{ cre_name }}
triggers:
- type: registration
- name: Wait for the scheduled task to complete
win_scheduled_task_stat:
name: "{{ task_name }}"
register: task_stat
until: (task_stat.state is defined and task_stat.state.status != "TASK_STATE_RUNNING") or (task_stat.task_exists == False)
retries: 7
delay: 5
- name: delete task_scheduled
win_scheduled_task:
name: "{{ task_name }}"
state: absent
タスクスケジューラ削除
---
# ■処理概要
# Managedノード(windows)のタスクスケジュールを削除する。
# 対象のタスクは、task_nameに指定する。
# 指定方法は以下の2種類から選択する。
# (1) awxのテンプレートの"追加変数"に以下の形式で指定
# loop_vars:
# - task_name: add_windows_credential
# - task_name: delete_windows_credential
# (2) 本ファイル内に指定(通常はコメントアウト)
#
- name: win_mod_task_scheduled_delete.yml
hosts: windows
gather_facts: false
tasks:
- name: delete task_scheduled
win_scheduled_task:
name: "{{ item.task_name }}"
state: absent
with_items: "{{ loop_vars }}"
# vars:
# loop_vars:
# - task_name: add_windows_credential
# - task_name: delete_windows_credential
サービス状態チェック
ステータス取得の参考にしたページ
https://qiita.com/hiroyuki_onodera/items/b42f728c2270a7bccd97
---
- name: win_ref_service_status
hosts: windows
gather_facts: false
tasks:
- name: ref_service_status
ansible.windows.win_service_info:
name: Windows Update
register: result
- name: デバッグ
debug:
var: result.services|map(attribute='state')|first
- debug:
msg: "OK"
when: result.services|map(attribute='state')|first == "started"
- debug:
msg: "NG"
when: result.services|map(attribute='state')|first != "started"
- name: ref_service_status
ansible.windows.win_service_info:
name: Windows Time
register: result
- name: デバッグ
debug:
var: result.services|map(attribute='state')|first
- debug:
msg: "OK"
when: result.services|map(attribute='state')|first == "started"
- debug:
msg: "NG"
when: result.services|map(attribute='state')|first != "started"
実行結果
PLAY [win_ref_service_status] ******************************************************************************************************************************************************************************************************
TASK [ref_service_status] **********************************************************************************************************************************************************************************************************
ok: [192.168.1.212]
TASK [デバッグ] ************************************************************************************************************************************************************************************************************************
ok: [192.168.1.212] => {
"result.services|list|map(attribute='state')|list|first": "started"
}
TASK [debug] ***********************************************************************************************************************************************************************************************************************
ok: [192.168.1.212] => {
"msg": "OK"
}
TASK [debug] ***********************************************************************************************************************************************************************************************************************
skipping: [192.168.1.212]
TASK [ref_service_status] **********************************************************************************************************************************************************************************************************
ok: [192.168.1.212]
TASK [デバッグ] ************************************************************************************************************************************************************************************************************************
ok: [192.168.1.212] => {
"result.services|list|map(attribute='state')|list|first": "stopped"
}
TASK [debug] ***********************************************************************************************************************************************************************************************************************
skipping: [192.168.1.212]
TASK [debug] ***********************************************************************************************************************************************************************************************************************
ok: [192.168.1.212] => {
"msg": "NG"
}
PLAY RECAP *************************************************************************************************************************************************************************************************************************
192.168.1.212 : ok=6 changed=0 unreachable=0 failed=0 skipped=2 rescued=0 ignored=0
画面表示が多いがループさせる場合はこちら
---
- name: win_ref_service_status
hosts: windows
gather_facts: False
vars:
loop_vars:
- service_name: "Windows Update"
- service_name: "Windows Time"
tasks:
- name: ref_service_status
ansible.windows.win_service_info:
name: "{{ item.service_name }}"
register: result
with_items: "{{ loop_vars }}"
- debug:
msg: "{{ item.services|map(attribute='state')|first }}"
with_items: "{{ result.results }}"
- debug:
msg: "OK"
when: item.services|map(attribute='state')|first == "started"
with_items: "{{ result.results }}"
- debug:
msg: "NG"
when: item.services|map(attribute='state')|first != "started"
with_items: "{{ result.results }}"
実行結果
PLAY [win_ref_service_status] ***************************************************************************************
TASK [ref_service_status] *******************************************************************************************
ok: [192.168.1.212] => (item={u'service_name': u'Windows Update'})
ok: [192.168.1.212] => (item={u'service_name': u'Windows Time'})
TASK [debug] ********************************************************************************************************
ok: [192.168.1.212] => (item={u'item': {u'service_name': u'Windows Update'}, u'ansible_loop_var': u'item', u'services': [{u'service_flags': [], u'username': u'NT AUTHORITY\\SYSTEM', u'process_id': 3288, u'failure_command': None, u'launch_protection': u'none', u'failure_actions_on_non_crash_failure': False, u'pre_shutdown_timeout_ms': 10000, u'required_privileges': [u'SeAuditPrivilege', u'SeCreateGlobalPrivilege', u'SeCreatePageFilePrivilege', u'SeTcbPrivilege', u'SeAssignPrimaryTokenPrivilege', u'SeImpersonatePrivilege', u'SeIncreaseQuotaPrivilege', u'SeShutdownPrivilege', u'SeDebugPrivilege', u'SeBackupPrivilege', u'SeRestorePrivilege', u'SeSecurityPrivilege', u'SeTakeOwnershipPrivilege', u'SeLoadDriverPrivilege', u'SeManageVolumePrivilege', u'SeSystemEnvironmentPrivilege', u'SeCreateSymbolicLinkPrivilege', u'SeIncreaseBasePriorityPrivilege'], u'wait_hint_ms': 0, u'failure_reset_period_sec': 86400, u'failure_actions': [{u'type': u'restart', u'delay_ms': 60000}, {u'type': u'none', u'delay_ms': 0}, {u'type': u'none', u'delay_ms': 0}], u'sid_info': u'unrestricted', u'dependency_of': [], u'load_order_group': u'', u'path': u'C:\\Windows\\system32\\svchost.exe -k netsvcs -p', u'service_exit_code': 0, u'failure_reboot_msg': None, u'description': u'Windows \u304a\u3088\u3073\u305d\u306e\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5bfe\u3059\u308b\u66f4\u65b0\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u691c\u51fa\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u304a\u3088\u3073\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u304c\u7121\u52b9\u306a\u5834\u5408\u3001\u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30e6\u30fc\u30b6\u30fc\u306f Windows Update \u307e\u305f\u306f\u305d\u306e\u81ea\u52d5\u66f4\u65b0\u6a5f\u80fd\u3092\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u308b Windows Update Agent (WUA) API \u3082\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002', u'preferred_node': None, u'display_name': u'Windows Update', u'name': u'wuauserv', u'triggers': [{u'action': u'start_service', u'sub_type_guid': u'659fcae6-5bdb-4da9-b1ff-ca2a178d46e0', u'type': u'group_policy', u'sub_type': u'machine_policy_present', u'data_items': []}, {u'action': u'start_service', u'sub_type_guid': u'54fb46c8-f089-464c-b1fd-59d1b62c3b50', u'type': u'group_policy', u'sub_type': u'user_policy_present', u'data_items': []}], u'start_mode': u'manual', u'error_control': u'normal', u'win32_exit_code': 0, u'checkpoint': 0, u'state': u'started', u'dependencies': [u'rpcss'], u'service_type': u'win32_share_process', u'desktop_interact': False, u'controls_accepted': [u'stop', u'power_event', u'session_change', u'pre_shutdown']}], u'exists': True, u'failed': False, u'invocation': {u'module_args': {u'name': u'Windows Update'}}, u'changed': False}) => {
"msg": "started"
}
ok: [192.168.1.212] => (item={u'item': {u'service_name': u'Windows Time'}, u'ansible_loop_var': u'item', u'services': [{u'service_flags': [], u'username': u'NT AUTHORITY\\LocalService', u'process_id': 0, u'failure_command': None, u'launch_protection': u'none', u'failure_actions_on_non_crash_failure': False, u'pre_shutdown_timeout_ms': 10000, u'required_privileges': [u'SeAuditPrivilege', u'SeChangeNotifyPrivilege', u'SeCreateGlobalPrivilege', u'SeSystemTimePrivilege', u'SeImpersonatePrivilege'], u'wait_hint_ms': 0, u'failure_reset_period_sec': 86400, u'failure_actions': [{u'type': u'restart', u'delay_ms': 60000}, {u'type': u'restart', u'delay_ms': 120000}, {u'type': u'none', u'delay_ms': 0}], u'sid_info': u'unrestricted', u'dependency_of': [], u'load_order_group': u'', u'path': u'C:\\Windows\\system32\\svchost.exe -k LocalService', u'service_exit_code': 0, u'failure_reboot_msg': None, u'description': u'\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4e0a\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u306e\u65e5\u6642\u306e\u540c\u671f\u3092\u7dad\u6301\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3059\u308b\u3068\u3001\u65e5\u6642\u306e\u540c\u671f\u306f\u884c\u308f\u308c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u7121\u52b9\u306b\u3059\u308b\u3068\u3001\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d3\u30b9\u306f\u8d77\u52d5\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002', u'preferred_node': None, u'display_name': u'Windows Time', u'name': u'W32Time', u'triggers': [{u'action': u'start_service', u'sub_type_guid': u'1ce20aba-9851-4421-9430-1ddeb766e809', u'type': u'domain_join', u'sub_type': u'domain_join', u'data_items': []}], u'start_mode': u'manual', u'error_control': u'normal', u'win32_exit_code': 0, u'checkpoint': 0, u'state': u'stopped', u'dependencies': [], u'service_type': u'win32_share_process', u'desktop_interact': False, u'controls_accepted': []}], u'exists': True, u'failed': False, u'invocation': {u'module_args': {u'name': u'Windows Time'}}, u'changed': False}) => {
"msg": "stopped"
}
TASK [debug] ********************************************************************************************************
ok: [192.168.1.212] => (item=[{u'service_flags': [], u'username': u'NT AUTHORITY\\SYSTEM', u'process_id': 3288, u'failure_command': None, u'launch_protection': u'none', u'failure_actions_on_non_crash_failure': False, u'pre_shutdown_timeout_ms': 10000, u'required_privileges': [u'SeAuditPrivilege', u'SeCreateGlobalPrivilege', u'SeCreatePageFilePrivilege', u'SeTcbPrivilege', u'SeAssignPrimaryTokenPrivilege', u'SeImpersonatePrivilege', u'SeIncreaseQuotaPrivilege', u'SeShutdownPrivilege', u'SeDebugPrivilege', u'SeBackupPrivilege', u'SeRestorePrivilege', u'SeSecurityPrivilege', u'SeTakeOwnershipPrivilege', u'SeLoadDriverPrivilege', u'SeManageVolumePrivilege', u'SeSystemEnvironmentPrivilege', u'SeCreateSymbolicLinkPrivilege', u'SeIncreaseBasePriorityPrivilege'], u'wait_hint_ms': 0, u'failure_reset_period_sec': 86400, u'failure_actions': [{u'type': u'restart', u'delay_ms': 60000}, {u'type': u'none', u'delay_ms': 0}, {u'type': u'none', u'delay_ms': 0}], u'sid_info': u'unrestricted', u'dependency_of': [], u'load_order_group': u'', u'path': u'C:\\Windows\\system32\\svchost.exe -k netsvcs -p', u'service_exit_code': 0, u'failure_reboot_msg': None, u'description': u'Windows \u304a\u3088\u3073\u305d\u306e\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5bfe\u3059\u308b\u66f4\u65b0\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u691c\u51fa\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u304a\u3088\u3073\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u304c\u7121\u52b9\u306a\u5834\u5408\u3001\u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30e6\u30fc\u30b6\u30fc\u306f Windows Update \u307e\u305f\u306f\u305d\u306e\u81ea\u52d5\u66f4\u65b0\u6a5f\u80fd\u3092\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u308b Windows Update Agent (WUA) API \u3082\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002', u'preferred_node': None, u'display_name': u'Windows Update', u'name': u'wuauserv', u'triggers': [{u'action': u'start_service', u'sub_type_guid': u'659fcae6-5bdb-4da9-b1ff-ca2a178d46e0', u'type': u'group_policy', u'sub_type': u'machine_policy_present', u'data_items': []}, {u'action': u'start_service', u'sub_type_guid': u'54fb46c8-f089-464c-b1fd-59d1b62c3b50', u'type': u'group_policy', u'sub_type': u'user_policy_present', u'data_items': []}], u'start_mode': u'manual', u'error_control': u'normal', u'win32_exit_code': 0, u'checkpoint': 0, u'state': u'started', u'dependencies': [u'rpcss'], u'service_type': u'win32_share_process', u'desktop_interact': False, u'controls_accepted': [u'stop', u'power_event', u'session_change', u'pre_shutdown']}]) => {
"msg": "OK"
}
skipping: [192.168.1.212] => (item=[{u'service_flags': [], u'username': u'NT AUTHORITY\\LocalService', u'process_id': 0, u'failure_command': None, u'launch_protection': u'none', u'failure_actions_on_non_crash_failure': False, u'pre_shutdown_timeout_ms': 10000, u'required_privileges': [u'SeAuditPrivilege', u'SeChangeNotifyPrivilege', u'SeCreateGlobalPrivilege', u'SeSystemTimePrivilege', u'SeImpersonatePrivilege'], u'wait_hint_ms': 0, u'failure_reset_period_sec': 86400, u'failure_actions': [{u'type': u'restart', u'delay_ms': 60000}, {u'type': u'restart', u'delay_ms': 120000}, {u'type': u'none', u'delay_ms': 0}], u'sid_info': u'unrestricted', u'dependency_of': [], u'load_order_group': u'', u'path': u'C:\\Windows\\system32\\svchost.exe -k LocalService', u'service_exit_code': 0, u'failure_reboot_msg': None, u'description': u'\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4e0a\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u306e\u65e5\u6642\u306e\u540c\u671f\u3092\u7dad\u6301\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3059\u308b\u3068\u3001\u65e5\u6642\u306e\u540c\u671f\u306f\u884c\u308f\u308c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u7121\u52b9\u306b\u3059\u308b\u3068\u3001\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d3\u30b9\u306f\u8d77\u52d5\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002', u'preferred_node': None, u'display_name': u'Windows Time', u'name': u'W32Time', u'triggers': [{u'action': u'start_service', u'sub_type_guid': u'1ce20aba-9851-4421-9430-1ddeb766e809', u'type': u'domain_join', u'sub_type': u'domain_join', u'data_items': []}], u'start_mode': u'manual', u'error_control': u'normal', u'win32_exit_code': 0, u'checkpoint': 0, u'state': u'stopped', u'dependencies': [], u'service_type': u'win32_share_process', u'desktop_interact': False, u'controls_accepted': []}])
TASK [debug] ********************************************************************************************************
skipping: [192.168.1.212] => (item={u'item': {u'service_name': u'Windows Update'}, u'ansible_loop_var': u'item', u'services': [{u'service_flags': [], u'username': u'NT AUTHORITY\\SYSTEM', u'process_id': 3288, u'failure_command': None, u'launch_protection': u'none', u'failure_actions_on_non_crash_failure': False, u'pre_shutdown_timeout_ms': 10000, u'required_privileges': [u'SeAuditPrivilege', u'SeCreateGlobalPrivilege', u'SeCreatePageFilePrivilege', u'SeTcbPrivilege', u'SeAssignPrimaryTokenPrivilege', u'SeImpersonatePrivilege', u'SeIncreaseQuotaPrivilege', u'SeShutdownPrivilege', u'SeDebugPrivilege', u'SeBackupPrivilege', u'SeRestorePrivilege', u'SeSecurityPrivilege', u'SeTakeOwnershipPrivilege', u'SeLoadDriverPrivilege', u'SeManageVolumePrivilege', u'SeSystemEnvironmentPrivilege', u'SeCreateSymbolicLinkPrivilege', u'SeIncreaseBasePriorityPrivilege'], u'wait_hint_ms': 0, u'failure_reset_period_sec': 86400, u'failure_actions': [{u'type': u'restart', u'delay_ms': 60000}, {u'type': u'none', u'delay_ms': 0}, {u'type': u'none', u'delay_ms': 0}], u'sid_info': u'unrestricted', u'dependency_of': [], u'load_order_group': u'', u'path': u'C:\\Windows\\system32\\svchost.exe -k netsvcs -p', u'service_exit_code': 0, u'failure_reboot_msg': None, u'description': u'Windows \u304a\u3088\u3073\u305d\u306e\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5bfe\u3059\u308b\u66f4\u65b0\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u691c\u51fa\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u304a\u3088\u3073\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u304c\u7121\u52b9\u306a\u5834\u5408\u3001\u3053\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306e\u30e6\u30fc\u30b6\u30fc\u306f Windows Update \u307e\u305f\u306f\u305d\u306e\u81ea\u52d5\u66f4\u65b0\u6a5f\u80fd\u3092\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u308b Windows Update Agent (WUA) API \u3082\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002', u'preferred_node': None, u'display_name': u'Windows Update', u'name': u'wuauserv', u'triggers': [{u'action': u'start_service', u'sub_type_guid': u'659fcae6-5bdb-4da9-b1ff-ca2a178d46e0', u'type': u'group_policy', u'sub_type': u'machine_policy_present', u'data_items': []}, {u'action': u'start_service', u'sub_type_guid': u'54fb46c8-f089-464c-b1fd-59d1b62c3b50', u'type': u'group_policy', u'sub_type': u'user_policy_present', u'data_items': []}], u'start_mode': u'manual', u'error_control': u'normal', u'win32_exit_code': 0, u'checkpoint': 0, u'state': u'started', u'dependencies': [u'rpcss'], u'service_type': u'win32_share_process', u'desktop_interact': False, u'controls_accepted': [u'stop', u'power_event', u'session_change', u'pre_shutdown']}], u'exists': True, u'failed': False, u'invocation': {u'module_args': {u'name': u'Windows Update'}}, u'changed': False})
ok: [192.168.1.212] => (item={u'item': {u'service_name': u'Windows Time'}, u'ansible_loop_var': u'item', u'services': [{u'service_flags': [], u'username': u'NT AUTHORITY\\LocalService', u'process_id': 0, u'failure_command': None, u'launch_protection': u'none', u'failure_actions_on_non_crash_failure': False, u'pre_shutdown_timeout_ms': 10000, u'required_privileges': [u'SeAuditPrivilege', u'SeChangeNotifyPrivilege', u'SeCreateGlobalPrivilege', u'SeSystemTimePrivilege', u'SeImpersonatePrivilege'], u'wait_hint_ms': 0, u'failure_reset_period_sec': 86400, u'failure_actions': [{u'type': u'restart', u'delay_ms': 60000}, {u'type': u'restart', u'delay_ms': 120000}, {u'type': u'none', u'delay_ms': 0}], u'sid_info': u'unrestricted', u'dependency_of': [], u'load_order_group': u'', u'path': u'C:\\Windows\\system32\\svchost.exe -k LocalService', u'service_exit_code': 0, u'failure_reboot_msg': None, u'description': u'\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4e0a\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u306e\u65e5\u6642\u306e\u540c\u671f\u3092\u7dad\u6301\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3059\u308b\u3068\u3001\u65e5\u6642\u306e\u540c\u671f\u306f\u884c\u308f\u308c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u7121\u52b9\u306b\u3059\u308b\u3068\u3001\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d3\u30b9\u306f\u8d77\u52d5\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002', u'preferred_node': None, u'display_name': u'Windows Time', u'name': u'W32Time', u'triggers': [{u'action': u'start_service', u'sub_type_guid': u'1ce20aba-9851-4421-9430-1ddeb766e809', u'type': u'domain_join', u'sub_type': u'domain_join', u'data_items': []}], u'start_mode': u'manual', u'error_control': u'normal', u'win32_exit_code': 0, u'checkpoint': 0, u'state': u'stopped', u'dependencies': [], u'service_type': u'win32_share_process', u'desktop_interact': False, u'controls_accepted': []}], u'exists': True, u'failed': False, u'invocation': {u'module_args': {u'name': u'Windows Time'}}, u'changed': False}) => {
"msg": "NG"
}
PLAY RECAP **********************************************************************************************************
192.168.1.212 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0