Skip to Content
Ansible: 시작부터 끝까지, 3판
book

Ansible: 시작부터 끝까지, 3판

by Bas Meijer, Lorin Hochstein, René Moser
May 2025
Beginner to intermediate
472 pages
7h 11m
Korean
O'Reilly Media, Inc.
Book available
Content preview from Ansible: 시작부터 끝까지, 3판

3장. 플레이북 시작하기

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

Ansible을 사용하기 시작하면 가장 먼저 할 일 중 하나는 플레이북 작성을 시작하는 것입니다. 플레이북은 Ansible에서 구성 관리 스크립트에 사용하는 용어입니다. 예를 들어, 다음은 NGINX 웹 서버를 설치하고 보안 통신을 위해 구성하기 위한 플레이북입니다.

이 장의 내용을 따라가다 보면 여기에 나열된 디렉토리 트리를 보게 될 것입니다:

.
├── Vagrantfile
├── ansible.cfg
├── files
│   ├── index.html
│   ├── nginx.conf
│   ├── nginx.crt
│   └── nginx.key
├── inventory
│   └── vagrant.ini
├── requirements.txt
├── templates
│   ├── index.html.j2
│   └── nginx.conf.j2
├── webservers-tls.yml
├── webservers.yml
└── webservers2.yml

예선전

다음과 같이 보이도록 Vagrant파일을 수정합니다:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/focal64"
  config.vm.hostname = "testserver"
  config.vm.network "forwarded_port",
    id: 'ssh', guest: 22, host: 2202, host_ip: "127.0.0.1", auto_correct: false
  config.vm.network "forwarded_port",
    id: 'http', guest: 80, host: 8080, host_ip: "127.0.0.1"
  config.vm.network "forwarded_port",
    id: 'https', guest: 443, host: 8443, host_ip: "127.0.0.1"
  # disable updating guest additions
  if Vagrant.has_plugin?("vagrant-vbguest")
    config.vbguest.auto_update = false
  end
  config.vm.provider "virtualbox" do |virtualbox|
    virtualbox.name = "ch03"
  end
end

이렇게 하면 로컬 머신의 포트 8080이 Vagrant 머신의 포트 80으로, 로컬 머신의 포트 8443이 Vagrant 머신의 포트 443으로 매핑됩니다. 또한 1장의 다른 가상 머신을 계속 실행할 수 있으므로 이 특정 가상 머신(VM)에 대한 포워딩 포트 2202를 예약합니다. 이러한 변경을 수행한 후에는 다음 명령을 실행하여 Vagrant가 이를 구현하도록 지시합니다:

$ vagrant up

다음과 같은 출력이 표시됩니다:

 ==> default: Forwarding ports... default: 22 (guest) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes 오퍼레이터

Kubernetes 오퍼레이터

Jason Dobies, Joshua Wood

Publisher Resources

ISBN: 9798341653900Supplemental Content