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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
あんでぃー
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
800
なぜSIerは自動化するのか/Why do SIers automate?
answerd
0
190
Other Decks in Technology
See All in Technology
When Platform Engineering Meets GenAI
sucitw
0
170
Deep Data Security 機能解説
oracle4engineer
PRO
2
120
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
120
Comment regagner la souveraineté de vos données tout en étant payé grâce à Nostr !
rlifchitz
0
200
脱SaaS!FDEを支えるプロビジョニングと分離設計
knih
0
300
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
510
事業会社における 機械学習・推薦システム技術の活用事例と必要な能力 / ml-recsys-in-layerx-wantedly-2026
yuya4
0
160
「ビジネスがわかるエンジニア」とは何か?
ryooob
0
300
2026-06-24_人とAIの責務分離に基づく開発プロセスの提案.pdf
takahiromatsui
0
120
徹底討論!ECS vs EKS!
daitak
3
1.7k
SteampipeとExcel Power QueryでAWS構成定義書の作成を自動化する
jhashimoto
0
180
Zenoh on Zephyr on LiteX
takasehideki
2
110
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
400
New Earth Scene 8
popppiees
3
2.4k
Rails Girls Zürich Keynote
gr2m
96
14k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
170
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
370
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Technical Leadership for Architectural Decision Making
baasie
3
420
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Facilitating Awesome Meetings
lara
57
7k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
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ͰϓϨΠϒοΫݕূ͢Δڥ࡞ͬͨ • ؆୯ʹͰ͖ͯ͘͢͝ศརͩͬͨ • Ͱࣄલʹ։ൃڥͬͱߟ͑ͯʂʂʂʂʂ(ഭਅ)
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ