Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Ansible-Playbook-CleanUp-WinUpd-TempFiles
Hisashi SOGA
PRO
September 01, 2017
Programming
2
2.4k
Ansible-Playbook-CleanUp-WinUpd-TempFiles
Windows Update の中間ファイル(ゴミ)を Ansible Playbook で一発で掃除することができるので事例を紹介します
Hisashi SOGA
PRO
September 01, 2017
Tweet
Share
More Decks by Hisashi SOGA
See All by Hisashi SOGA
NPOと取り組むスモールスタートな業務IT化 | TRACK C8
sogaoh
PRO
0
24
業務委託やコミュニティメンバーでも活用できる IAM Identity Center
sogaoh
PRO
0
850
PHPプロダクトのDeployをラクにするCLIツールたち
sogaoh
PRO
1
430
Laravelプロダクト Fargate化への道
sogaoh
PRO
2
900
本番でしか起きない問題に早く気が付けるように、僕は Laravel Dusk で CI する
sogaoh
PRO
0
480
間隙を縫って現場と自分を Extend していく流浪人スタイル
sogaoh
PRO
1
1.4k
sogaoh-2019
sogaoh
PRO
0
260
First step to Reiwa Shikimoku
sogaoh
PRO
0
180
gcloud move 10 times in 4 hours
sogaoh
PRO
0
880
Other Decks in Programming
See All in Programming
Amebaブログの会員画面システム刷新の道程
ryotasugawara
1
230
Prácticas de Seguridad en Kubernetes
pablokbs
0
120
僕が考えた超最強のKMMアプリの作り方
spbaya0141
0
180
Swift Observation
shiz
3
270
TokyoR#103_DataProcessing
kilometer
0
530
CDKでValidationする本当の方法 / cdk-validation
gotok365
1
200
Jetpack Compose 完全に理解した
mkeeda
1
450
%q is for Quine
koic
0
410
Zynq MP SoC で楽しむエッジコンピューティング ~RTLプログラミングのススメ~
ryuz88
0
330
データドリブンな組織の不正検知
fkubota
0
170
なぜRubyコミュニティにコミットするのか?
luccafort
0
310
Circuit⚡
monaapk
0
200
Featured
See All Featured
Visualization
eitanlees
128
12k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
Designing the Hi-DPI Web
ddemaree
273
32k
Reflections from 52 weeks, 52 projects
jeffersonlam
338
18k
What's in a price? How to price your products and services
michaelherold
233
9.7k
What the flash - Photography Introduction
edds
64
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
31
20k
Design by the Numbers
sachag
271
18k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
120
29k
Raft: Consensus for Rubyists
vanstee
130
5.7k
A Tale of Four Properties
chriscoyier
149
21k
Transcript
Windows Update ͷதؒϑΝΠϧ(ΰϛ)Λ Ansible Playbook ͰҰൃͰআ͢Δ 2017/09/01 @sogaoh 1 Presentation
Slide at https://ansible-users.connpass.com/event/62508/
AGENDA • ࣗݾհ • લఏ • ઃఆ • ࣮ߦ •
ҙ • ͓ΘΓʹ 2
ࣗݾհ • ીզɹԝ / Hisashi SOGA – Twitter : @sogaohɹ,
GitHub : sogaoh • Marketing Applications, Inc. / MApps – WebΞϯέʔτ࡞ɾ৴αʔϏε forSurvey – एճऩࠃNo.1ͷ MApps Panel • DevOpsਪਐࣨ (ফୂ ) – Πϯϑϥ ʛ˛˕˛˛˗˛ʵʛ ΞϓϦ – ϑϩϯτ ʛʵʵʵ˛˗˕˛ʛ αʔό ɹ 3 ◆࠷ॳ ˛कඋൣғ ˕ΠϚίί
લఏ • ※࣮ͨ͠ͷ͕̍͘Β͍લͰ͢ • Ansible (Server) ଆ (Playbook࣮ߦڥ) – CentOS
7.2, ansible 2.1.0.0, Python 2.7 • Windows (Agent) ଆ – Powershell 3 Ҏ্ (5 ΛೖΕͨ) – Win 2008 R2 ʹΠϯετʔϧ͕ඞཁɹɹɹɹɹ (2.0͕σϑΥϧτ) 4
ઃఆ (1) • Windows (Agent) ଆ • ઃఆεΫϦϓτμϯϩʔυ • ઃఆεΫϦϓτ࣮ߦ
• AllowUnencrypted="true"Λઃఆ 5 PS> Invoke-WebRequest -Uri https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ ConfigureRemotingForAnsible.ps1 -OutFile ConfigureRemotingForAnsible.ps1 PS> powershell -ExecutionPolicy RemoteSigned ./ConfigureRemotingForAnsible.ps1 PS C:\tmp> winrm set winrm/config/service '@{AllowUnencrypted="true"}'
ઃఆ (2) • Ansible (Server)ଆ • pywinrm ͷΠϯετʔϧ • Winଆͷࣗݾূ໌ॻݕূΛεΩοϓ͢ΔઃఆΛೖΕΔ
• /opt/ansible_win/ansible.cfg • ඌʹهɹɹɹɹɹɹɹɹɹɹɹͦͷଞௐ 6 $ sudo mkdir -p /opt/ansible/callback_plugins $ sudo vim /opt/ansible/callback_plugins/fix-ssl.py [defaults] bin_ansible_callbacks=True callback_plugins = ./callback_plugins ansible_winrm_server_cert_validation=ignore $ sudo pip install pywinrm inventory = /opt/ansible_win/hosts host_key_checking = False
࣮ߦ • ૄ௨֬ೝ • ࣮ߦ 7 ansible win-host-01 -m win_ping
env ANSIBLE_CONFIG=/opt/ansible_win/ansible.cfg ansible- playbook ./cleanup-win-update-tmp-files.yml -l win-host-01 env ANSIBLE_CONFIG=/opt/ansible_win/ansible.cfg ansible- playbook ./cleanup-win-installer-tmp-files.yml -l win-host-01 refs: https://github.com/sogaoh/AnsiblePractice/tree/master/operation/windows
ҙ • Οϧεରࡦιϑτ͕ೖ͍ͬͯΔ߹ • ϙʔτ5985, 5986 ͷղ์͕ඞཁ • ΞϯΠϯετʔϧ͕Ͱ͖ͳ͘ͳΔ •
ʮΓ͢ʯՄೳੑ͕͋ΔڥͰ࣮ߦ ʹҙɾݕূ͕ඞཁ 8
͓ΘΓʹ • Windows ʹର͢ΔఆܕԽ͞Ε͍ͯΔΦϖϨʔ γϣϯɺ͖ͬͱࣗಈԽɾ؆ૉԽͰ͖Δ • ଞʹɺAnsible ͰҎԼͷΑ͏ͳ͜ͱΛ؆ૉԽ͠ ͓ͯΓɺ୭ͰͰ͖Δମ੍Λ͍͑ͯ·͢ •
BIND ͷόʔδϣϯΞοϓ • STNS ΫϥΠΞϯτͷηοτΞοϓ • ͜ΜͳνʔϜʹjoin͍ͨ͠ͱࢥͬͨํ↓ͥͻɹ 9 https://jp.stanby.com/ats/marketing-applications/jobs