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
プレイブックの検証環境をdocker-composeで作った話/playbook tes...
Search
あんでぃー
February 12, 2020
Technology
890
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
プレイブックの検証環境をdocker-composeで作った話/playbook test environment by docker-compose
あんでぃー
February 12, 2020
More Decks by あんでぃー
See All by あんでぃー
AnsibleでVSCode拡張を管理しちゃおう!/why dont you manage vscode extension with Ansible?
answerd
2
810
なぜSIerは自動化するのか/Why do SIers automate?
answerd
0
190
Other Decks in Technology
See All in Technology
AI時代の闇と光
tatsuya1970
0
110
そのドキュメント、自動化しませんか?
yuksew
1
290
CDKで書くECSのベストプラクティス、 改めて考え直す2026 #cdkconf2026
makies
3
760
しぶいSRE: サーバから見えない障害にどう向き合うか。ラストワンマイルのデバッグ実践 / Shibui SRE
kanny
13
6.5k
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
8.4k
[2026-07-15] AI Ready なはずだったアーキテクチャと、見えてきた課題・次に目指す状態
wxyzzz
9
4k
Genie Ontologyは銀の弾丸かを考える / Is Genie Ontology a Silver Bullet?
nttcom
0
390
kintone の AI コワーカーを、 Anthropic にエージェントを"ホストさせて"作った話 #devkinmeetup
sugimomoto
0
110
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
130
Control Planeで育てるBtoB SaaSの認証基盤 - SRE NEXT 2026
pokohide
1
2.6k
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
5.9k
AI時代の開発生産性は、個人技からチーム設計へ
moongift
PRO
4
2.3k
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
470
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
310
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
A Modern Web Designer's Workflow
chriscoyier
698
190k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Designing for Timeless Needs
cassininazir
1
360
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
180
BBQ
matthewcrist
89
10k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
350
Transcript
ϓϨΠϒοΫͷݕূڥΛ docker-composeͰ࡞ͬͨ ͋ΜͰ͌ʔ @answer_d
ࣗݾհ • SIer • Πϯϑϥ͞Μ αʔόߏஙϚϯ • ʮAnsible͍ͬͯ͜͏Ͷʔʯͳ৬͚ͩͲීٴඍົ
͋ΔͷͰ͖͝ͱ
͋ΜͰ͌ʔ͘ΜAnsible Ͱ͖ΔΜͩΑͶʁ ͪΐͬͱͬͯΑʂ ͔͜͠·Γ
։ൃڥʁ ͳ͍ΑɺඞཁͩͬͨΒԿ͔ߟ͑ͯ
ΦϯϓϨҊ݅͋Δ͋Δ(͔ʁ)
ຊ൪ ։ൃ ౦ ։ൃڥ(·ͩ)ͳ͍
ຊ൪ ։ൃ ౦ (Ծʹ͋ͬͯ)ߏҧ͏ 2ϊʔυΫϥελ → γϯάϧ ౦ܥ →
౦ͷΈ ػೳ͝ͱʹαʔόׂ → ूͯ͠1 IPશવҧ͏
ϓϨΠϒοΫͷ࣭֬อ Ͳ͏͠Α͏ɾɾɾ
Ͱ͖Ε ຊ൪Ͱྲྀ͢ϓϨΠϒοΫΛ ͦͷ··ྲྀͯ͠ಈ࡞֬ೝ͍ͨ͠
DockerͰͰ͖ΔΜ͡ΌͶʁ
Γ·ͨ͠
ͬͨ͜ͱ • CentOSͷίϯςφͨ͘͞Μ → ຊ൪ڥͲ͖ ɾ 1ίϯςφ = 1αʔό(ͷΑ͏ͳԿ͔) •
docker-composeͰ·ͱΊ্ͯ͛Լ͛ • Ͱ͖Δ͚ͩຊ൪ڥΛ࠶ݱ ɾ ݻఆIP ɾ hostsͰ໊લղܾ
͍ํΠϝʔδ
$ docker-compose up up! ͚ͩʂ ຊ൪Ͳ͖ίϯςφୡ
࡞ͬͨͭ
Dockerfile
FROM centos:7 RUN true \ && echo ‘proxy=http://proxygate.sample:8080' >> /etc/yum.conf
\ && yum -y install epel-release \ && yum -y install ansible openssh-clients openssh-server \ && yum -y install libuuid.i686 libuuid.x86_64 libgcc.i686 libgcc.x86_64 \ && yum -y clean all \ && sed -i '$d' /etc/yum.conf \ && true RUN true \ && ssh-keygen -A -N '' \ && sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/ sshd_config \ && true RUN true \ && groupadd -g 1000 sampleuser \ && useradd -N -g sampleuser -u 1000 sampleuser \ && echo ‘sampleuser:$6$<ϋογϡ>’ | chpasswd --encrypted \ && echo ‘root:$6$<ϋογϡ>' | chpasswd --encrypted \ && true CMD [“/sbin/init"]
FROM centos:7 RUN true \ && echo ‘proxy=http://proxygate.sample:8080' >> /etc/yum.conf
\ && yum -y install epel-release \ && yum -y install ansible openssh-clients openssh-server \ && yum -y install libuuid.i686 libuuid.x86_64 libgcc.i686 libgcc.x86_64 \ && yum -y clean all \ && sed -i '$d' /etc/yum.conf \ && true RUN true \ && ssh-keygen -A -N '' \ && sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/ sshd_config \ && true RUN true \ && groupadd -g 1000 sampleuser \ && useradd -N -g sampleuser -u 1000 sampleuser \ && echo ‘sampleuser:$6$<ϋογϡ>’ | chpasswd --encrypted \ && echo ‘root:$6$<ϋογϡ>' | chpasswd --encrypted \ && true CMD [“/sbin/init"] CentOSΠϝʔδ͕ ϕʔεͰ
FROM centos:7 RUN true \ && echo ‘proxy=http://proxygate.sample:8080' >> /etc/yum.conf
\ && yum -y install epel-release \ && yum -y install ansible openssh-clients openssh-server \ && yum -y install libuuid.i686 libuuid.x86_64 libgcc.i686 libgcc.x86_64 \ && yum -y clean all \ && sed -i '$d' /etc/yum.conf \ && true RUN true \ && ssh-keygen -A -N '' \ && sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/ sshd_config \ && true RUN true \ && groupadd -g 1000 sampleuser \ && useradd -N -g sampleuser -u 1000 sampleuser \ && echo ‘sampleuser:$6$<ϋογϡ>’ | chpasswd --encrypted \ && echo ‘root:$6$<ϋογϡ>' | chpasswd --encrypted \ && true CMD [“/sbin/init"] Ansibleͱ͔ೖΕͯ ※ ࣾڥͷͨΊϓϩΩγܦ༝
FROM centos:7 RUN true \ && echo ‘proxy=http://proxygate.sample:8080' >> /etc/yum.conf
\ && yum -y install epel-release \ && yum -y install ansible openssh-clients openssh-server \ && yum -y install libuuid.i686 libuuid.x86_64 libgcc.i686 libgcc.x86_64 \ && yum -y clean all \ && sed -i '$d' /etc/yum.conf \ && true RUN true \ && ssh-keygen -A -N '' \ && sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/ sshd_config \ && true RUN true \ && groupadd -g 1000 sampleuser \ && useradd -N -g sampleuser -u 1000 sampleuser \ && echo ‘sampleuser:$6$<ϋογϡ>’ | chpasswd --encrypted \ && echo ‘root:$6$<ϋογϡ>' | chpasswd --encrypted \ && true CMD [“/sbin/init"] sshΛຊ൪ͱಉ͡ઃ ఆʹͯ͠
FROM centos:7 RUN true \ && echo ‘proxy=http://proxygate.sample:8080' >> /etc/yum.conf
\ && yum -y install epel-release \ && yum -y install ansible openssh-clients openssh-server \ && yum -y install libuuid.i686 libuuid.x86_64 libgcc.i686 libgcc.x86_64 \ && yum -y clean all \ && sed -i '$d' /etc/yum.conf \ && true RUN true \ && ssh-keygen -A -N '' \ && sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/ sshd_config \ && true RUN true \ && groupadd -g 1000 sampleuser \ && useradd -N -g sampleuser -u 1000 sampleuser \ && echo ‘sampleuser:$6$<ϋογϡ>’ | chpasswd --encrypted \ && echo ‘root:$6$<ϋογϡ>' | chpasswd --encrypted \ && true CMD [“/sbin/init"] ຊ൪ͱಉ͡Ϣʔβ ࡞ͬͯ
FROM centos:7 RUN true \ && echo ‘proxy=http://proxygate.sample:8080' >> /etc/yum.conf
\ && yum -y install epel-release \ && yum -y install ansible openssh-clients openssh-server \ && yum -y install libuuid.i686 libuuid.x86_64 libgcc.i686 libgcc.x86_64 \ && yum -y clean all \ && sed -i '$d' /etc/yum.conf \ && true RUN true \ && ssh-keygen -A -N '' \ && sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/ sshd_config \ && true RUN true \ && groupadd -g 1000 sampleuser \ && useradd -N -g sampleuser -u 1000 sampleuser \ && echo ‘sampleuser:$6$<ϋογϡ>’ | chpasswd --encrypted \ && echo ‘root:$6$<ϋογϡ>' | chpasswd --encrypted \ && true CMD [“/sbin/init"] initϓϩηεΛ࣮ߦ
docker-compose.yml
version: ‘2' services: master: build: context: ./images/cent7_ansible dockerfile: Dockerfile image:
internaltest/cent7_ansible hostname: master volumes: - ../ansible_playbook:/playbook working_dir: /playbook networks: infra_net: ipv4_address: 192.168.10.1 extra_hosts: - "master:192.168.10.1" - "target01:192.168.10.2" - "target02:192.168.10.3" - "target03:192.168.10.4" privileged: true target01: image: internaltest/cent7_ansible hostname: target01 networks: infra_net: ipv4_address: 192.168.10.2 privileged: true target02: … target03: … networks: infra_net: driver: bridge ipam: driver: default config: - subnet: 192.168.10.0/24 gateway: 192.168.10.254
target01: image: internaltest/cent7_ansible hostname: target01 networks: infra_net: ipv4_address: 192.168.10.2 privileged:
true target02: … target03: … networks: infra_net: driver: bridge ipam: driver: default config: - subnet: 192.168.10.0/24 gateway: 192.168.10.254 version: ‘2' services: master: build: context: ./images/cent7_ansible dockerfile: Dockerfile image: internaltest/cent7_ansible hostname: master volumes: - ../ansible_playbook:/playbook working_dir: /playbook networks: infra_net: ipv4_address: 192.168.10.1 extra_hosts: - "master:192.168.10.1" - "target01:192.168.10.2" - "target02:192.168.10.3" - "target03:192.168.10.4" privileged: true Ansibleϗετ λʔήοτϊʔυୡ
version: ‘2' services: master: build: context: ./images/cent7_ansible dockerfile: Dockerfile image:
internaltest/cent7_ansible hostname: master volumes: - ../ansible_playbook:/playbook working_dir: /playbook networks: infra_net: ipv4_address: 192.168.10.1 extra_hosts: - "master:192.168.10.1" - "target01:192.168.10.2" - "target02:192.168.10.3" - "target03:192.168.10.4" privileged: true ͖ͬ͞ͷ Dockerfile target01: image: internaltest/cent7_ansible hostname: target01 networks: infra_net: ipv4_address: 192.168.10.2 privileged: true target02: … target03: … networks: infra_net: driver: bridge ipam: driver: default config: - subnet: 192.168.10.0/24 gateway: 192.168.10.254
version: ‘2' services: master: build: context: ./images/cent7_ansible dockerfile: Dockerfile image:
internaltest/cent7_ansible hostname: master volumes: - ../ansible_playbook:/playbook working_dir: /playbook networks: infra_net: ipv4_address: 192.168.10.1 extra_hosts: - "master:192.168.10.1" - "target01:192.168.10.2" - "target02:192.168.10.3" - "target03:192.168.10.4" privileged: true target01: image: internaltest/cent7_ansible hostname: target01 networks: infra_net: ipv4_address: 192.168.10.2 privileged: true target02: … target03: … networks: infra_net: driver: bridge ipam: driver: default config: - subnet: 192.168.10.0/24 gateway: 192.168.10.254 ݻఆIPׂΓͯ
version: ‘2' services: master: build: context: ./images/cent7_ansible dockerfile: Dockerfile image:
internaltest/cent7_ansible hostname: master volumes: - ../ansible_playbook:/playbook working_dir: /playbook networks: infra_net: ipv4_address: 192.168.10.1 extra_hosts: - "master:192.168.10.1" - "target01:192.168.10.2" - "target02:192.168.10.3" - "target03:192.168.10.4" privileged: true hosts target01: image: internaltest/cent7_ansible hostname: target01 networks: infra_net: ipv4_address: 192.168.10.2 privileged: true target02: … target03: … networks: infra_net: driver: bridge ipam: driver: default config: - subnet: 192.168.10.0/24 gateway: 192.168.10.254
Α͔ͬͨ͜ͱ • ࡞Δͷ؆୯ͩͬͨͷͰ(ແৼΓʹ) ͑Εͨ • Docker͑͋͞ΕͲ͜Ͱڥ্ཱ͕͕ͪΔ • ىಈఀࢭVMΑΓૣ͍ • down→up͚ͩͰॳظঢ়ଶʹͳΔͷΊͬͪΌศར
·ͱΊ
• docker-composeͰϓϨΠϒοΫݕূ͢Δڥ࡞ͬͨ • ؆୯ʹͰ͖ͯ͘͢͝ศརͩͬͨ • Ͱࣄલʹ։ൃڥͬͱߟ͑ͯʂʂʂʂʂ(ഭਅ)
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ