Slide 1

Slide 1 text

1 Ansible 2.8: WindowsへSSH接続してみよう Ansible 2.8 x Windows Kento Yagisawa Technical Support Engineer (Ansible)

Slide 2

Slide 2 text

Ansible 2.8 x Windows 2 自己紹介 八木澤 健人 (やぎさわ けんと) Ansible Engine / Ansible Tower のテクニカルサポートをしています 趣味: ロードバイク / ゲーム / Ansible @hiyoko_taisa https://github.com/hiyokotaisa

Slide 3

Slide 3 text

Ansible 2.8 x Windows 3 [Question] Ansibleを使ったことがある方?

Slide 4

Slide 4 text

Ansible 2.8 x Windows 4 [Question] AnsibleでWindowsを自動化 したことがある方?

Slide 5

Slide 5 text

Ansible 2.8 x Windows 5 Ansible 2.8で追加された新機能 ● Connection PluginにSSHを指定可能 (Experimental Support) ● 新モジュール: ○ win_user_profile ○ win_partition ○ win_psrepository

Slide 6

Slide 6 text

Ansible 2.8 x Windows 6 ようこそSSH! (ベータだけど)

Slide 7

Slide 7 text

Ansible 2.8 x Windows 7 従来: WinRMによる接続 ● HTTPS/HTTPベースの独自プロトコル ● ansible_connection: winrm を指定する ● Remote Management Serviceの有効化などの事前設定が必要 WinRM(WS-Management) HTTPS / HTTP Windows

Slide 8

Slide 8 text

Ansible 2.8 x Windows 8 SSHによる接続 ● Linux/Unixなどで広く使われてきたプロトコル ● WinRMと比較してオーバーヘッドが少ない ● ansible_connection: ssh を指定する ● Windows側にOpenSSHのインストールが必要 Win32-OpenSSH SSH Windows

Slide 9

Slide 9 text

Ansible 2.8 x Windows 9 SSH接続手順 1. Win32-OpenSSHのインストール 参考: https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH 2. sshd_configの設定変更 (必要に応じて) PATH: %programdata%\ssh\sshd_config 3. ansible_shell_type を指定 ( cmd | powershell ) Windows側のDefault Shell設定と一致している必要がある (デフォルトはcmd.exe) 注意事項: v7.9.0.0p1-Betaより以前のバージョンのOpenSSHは、 ansible_shell_type: powershell を指定できない。 (Windows Server 2019に同梱されているOpenSSHなど)

Slide 10

Slide 10 text

Ansible 2.8 x Windows 10 Win32-OpenSSHのインストール Win32-OpenSSHのインストールは、ChocolateyもしくはAnsible GalaxyのRoleからも実行可能 $ ansible-galaxy install jborean93.win_openssh 参考: https://galaxy.ansible.com/jborean93/win_openssh

Slide 11

Slide 11 text

Ansible 2.8 x Windows 11 Playbook

Slide 12

Slide 12 text

Ansible 2.8 x Windows 12 実行結果

Slide 13

Slide 13 text

Ansible 2.8 x Windows 13 SSHで接続していることが読み取れる

Slide 14

Slide 14 text

Ansible 2.8 x Windows 14 参考資料 ● Windows SSH Setup - Ansible https://docs.ansible.com/ansible/2.8/user_guide/windows_setup.html#windows-ssh-setup ● Win32-OpenSSH https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH ● Galaxy Role https://galaxy.ansible.com/jborean93/win_openssh

Slide 15

Slide 15 text

CONFIDENTIAL Designator linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat 15 Red Hat is the world’s leading provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500. Thank you OPTIONAL SECTION MARKER OR TITLE