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
PLATEAU で バーチャル花火大会
tatsuya1970
0
110
Data Hubグループ 紹介資料
sansan33
PRO
0
3.1k
関東Kaggler会発表資料
takoi
1
160
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
【Google Cloud Next Tokyo'26】Gemini Enterprise と Oracle AI Database で実現する、業務データ活用を実現する AI エージェント実装
shisyu_gaku
0
230
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
290
FPGAが実現する遠方宇宙の高空間分解能天体撮影 -大型地上望遠鏡の視力を補正する「補償光学」とは?-
komei_mt
0
170
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
1
200
20260801_スクフェス大阪
kgnkhkr
2
1.2k
Digitization部 紹介資料
sansan33
PRO
2
7.7k
Issue設計から始める仕様駆動開発 / 20260731 Mizuki Hirata
shift_evolve
PRO
1
150
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
120
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.9k
Building Applications with DynamoDB
mza
96
7.2k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
400
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
420
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Discover your Explorer Soul
emna__ayadi
2
1.2k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
330
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
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ͰϓϨΠϒοΫݕূ͢Δڥ࡞ͬͨ • ؆୯ʹͰ͖ͯ͘͢͝ศརͩͬͨ • Ͱࣄલʹ։ൃڥͬͱߟ͑ͯʂʂʂʂʂ(ഭਅ)
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ