Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AnsibleではじめるWindows自動化
Search
hiyokotaisa
June 30, 2018
Technology
6.8k
7
Share
AnsibleではじめるWindows自動化
Interact 2018でお話ししたAnsibleによるWindows自動化のセッション資料です。
hiyokotaisa
June 30, 2018
More Decks by hiyokotaisa
See All by hiyokotaisa
JTF2020 C1: テクニカルサポートエンジニアという働き方
hiyokotaisa
2
15k
RHTN - 5分でわかるAnsible TowerのSSO
hiyokotaisa
0
310
Interact 2019 -OP01: ひよこでもわかるAnsible AnsibleによるAzure構成管理
hiyokotaisa
3
3k
RHTN: Ansible 2.8 x Windows
hiyokotaisa
1
4.2k
Twitter転職でなってみたグローバルサポートエンジニア
hiyokotaisa
1
2.3k
インフラ勉強会にみるコミュニティへの「貢献」
hiyokotaisa
2
3.1k
Red Hat Tech Night 2018: Ansible x Network Ansibleで実践するネットワーク自動化
hiyokotaisa
1
1.4k
Other Decks in Technology
See All in Technology
3つのボトルネックを解消し、リリースエンジニアリングを再定義した話
nealle
0
490
ハーネスエンジニアリングの概要と設計思想
sergicalsix
3
590
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
490
Azure Lifecycle with Copilot CLI
torumakabe
3
950
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.3k
実践ハーネスエンジニアリング:TAKTで実現するAIエージェント制御 / Practical Harness Engineering: AI Agent Control Enabled by TAKT
nrslib
3
1.2k
マルチエージェント × ハーネスエンジニアリング × GitLab Duo Agent Platformで実現する「AIエージェントに仕事をさせる時代へ。」 / 20260421 GitLab Duo Agent Platform
n11sh1
0
110
Zero-Downtime Migration: Moving a Massive, Historic iOS App from CocoaPods to SPM and Tuist without Stopping Feature Delivery
kagemiku
0
240
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
3
230
最近の技術系の話題で気になったもの色々(IoT系以外も) / IoTLT 花見予定会(たぶんBBQ) @都立潮風公園バーベキュー広場
you
PRO
1
200
目的ファーストのハーネス設計 ~ハーネスの変更容易性を高めるための優先順位~
gotalab555
2
630
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
40
2.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
160
Color Theory Basics | Prateek | Gurzu
gurzu
0
290
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1k
sira's awesome portfolio website redesign presentation
elsirapls
0
210
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
Building Flexible Design Systems
yeseniaperezcruz
330
40k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Test your architecture with Archunit
thirion
1
2.2k
AI: The stuff that nobody shows you
jnunemaker
PRO
5
550
Code Review Best Practice
trishagee
74
20k
Transcript
Windows x Ansible Ansible ではじめる Windows 自動化 Interact 2018 |
June. 30th, 2018
Interact 2018 2 ひよこ大佐 テクニカルサポートエンジニア 3月にTwitter転職しました Twitter: @hiyoko_taisa blog :
http://hiyoko-infratech.hateblo.jp/ 自己紹介
Interact 2018 3 1. Ansibleとは 2. Windowsを管理しよう 3. トラブルシュート 本日のおしながき
Interact 2018 4 1. Ansibleの概要 2. Windowsを管理する上での基礎知識 3. トラブルシュートの基礎知識 本セッションでわかること
突然ですが……
Ansibleを使ったことがある人?
その中で…… AnsibleでWindowsを管理している人?
AnsibleはWindowsの管理でも 活躍します!
その前に…… Ansible とは?
Interact 2018 10 Ansibleとは? Red Hatとコミュニティで開発している構成管理ツール • 最新版はAnsible 2.6 (2018/6/29
リリース) • コミュニティ版とRed HatがサポートするAnsible Engine • 自動化オーケストレーションツールのAnsible Tower
Interact 2018 11 Ansibleの利点 • 学習コストの低いYAML形式のPlaybook • べき等性を保った変更 • シンプルかつ柔軟な拡張が可能
• コミュニティでの開発・拡張が活発 • 多種多様な環境をコントロール(Linux/Windows/Network機器)
Interact 2018 12 Ansible Playbookのサンプル --- - name: Add a
user hosts: all gather_facts: false tasks: - name: Add User win_user: name: ansible password: "@ns1bl3" state: present https://github.com/ansible/ansible-examples/blob/master/windows/create-user.yml
Interact 2018 13 Ansibleの接続イメージ SSH / WinRM
Interact 2018 14 Ansibleの構造 Inventory host_A host_B Playbook test.yml 1.
スクリプトを転送 host_A 3.結果を返却 Connection Plugin Modules 2.実行
Interact 2018 15 AnsibleでWindowsを管理するメリット • WindowsでもInfrastructure as Codeを実践 • Linuxサーバーと同時に自動化(統一化された管理)
Windows を管理しよう!
Interact 2018 17 必要なもの 事前準備 Playbook 作成 実行
Interact 2018 18 事前準備 ▪ Ansible側 • pywinrmのパッケージの導入 Playbookには…… •
ansible_connection: winrm を指定 • ansible_winrm_transportを指定
Interact 2018 19 Windows Serverを管理する ansible_winrm_transportで指定可能な認証方式
Interact 2018 20 Windows Serverを管理する ▪ Windows側 • Powershell 3.0以上
( Windows 7 SP1 / Windows Server 2008 SP1以上 ) • WinRM(Windows Remote Management)の有効化 • 自動でWindowsホストで必要な準備を実行するPowershellも (ConfigureRemotingForAnsible.ps1) https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotin gForAnsible.ps1
Interact 2018 21 Windows Module • 80を超えるWindows Module • 現在も増え続けている
Interact 2018 22 便利なWindows Module • win_domain_user Active Directoryのユーザを管理 win_domain_user:
name: bob firstname: Bob surname: Smith password: B0bP4ssw0rd state: present domain_username: DOMAIN\admin-account domain_password: SomePas2w0rd domain_server:
[email protected]
Interact 2018 23 便利なWindows Module • win_package パッケージのインストール/アンインストール • ネットワーク上のパッケージも取得可能
win_package: path: http://download.microsoft.com/.../vcredist_x64.exe product_id: '{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}' arguments: /install /passive /norestart
Interact 2018 24 便利なWindows Module • win_updates Windows Updateの実行 -
name: Install only particular updates based on the KB numbers win_updates: category_name: - SecurityUpdates whitelist: - KB4056892 - KB4073117
トラブルシューティング
Interact 2018 26 確認するべきポイント • pywinrmのバージョン(最新版への更新) • WinRMサービスの状態 • WinRM
Configの確認 • Debugログから原因を追跡
Interact 2018 27 WinRMのトラブルシューティング ▪ WinRMの設定の問題か切り分ける • 他のWindowsマシンからWinRM接続を試してみる # test
out HTTP winrs -r:http://server:5985/wsman -u:Username -p:Password ipconfig # test out HTTPS (will fail if the cert is not verifiable) winrs -r:http://server:5985/wsman -u:Username -p:Password -ssl ipconfig
Interact 2018 28 WinRMのトラブルシューティング ▪ WinRMの設定確認 > winrm get winrm/config
Interact 2018 29 winrm/configの出力結果
Interact 2018 30 Debug出力の確認 WinRMのConnection含む詳細な出力を確認可能 $ ansible-playbook -i inventory all
test.yml -vvvvv
Interact 2018 31 事例: HTTP 401/Credentials Rejected • HTTP 401
エラーの場合、接続時の認証で失敗している • 認証情報が正しいか • ユーザがlocal Administrator groupに属するユーザであること • ansible_winrm_transport で指定した認証方法が、 Service\Auth\下でEnableになっていること • Basic認証をADのユーザーに対して指定していないか • 関連するpythonパッケージを更新
Interact 2018 32 事例: HTTP 500 Error • WinRMサービスに問題がある •
サービス再起動など
Interact 2018 33 事例: Timeout • FirewallがWinRMのListenerポートをブロックしていないか • WinRMサービスが起動しているか •
ネットワークで問題が発生していないか • 負荷の高いタスクで発生する場合、Timeout値を伸ばしてみる ansible_winrm_operation_timeout_sec ansible_winrm_read_timeout_sec
THANK YOU!