Skip to main content

Ansible

Installation#

python3 -m pip install ansible

Control node#

ssh-keygen -t ed25519 -N "" -f <keyfile>
eval "$(ssh-agent -s)"
ssh-add <path>/<id file>
ssh-copy-id -i<path>/<id file>.pub [-p<port>] <managed user>@<managed ip>

Managed node#

sudo vidudo
...
<user> ALL=(ALL) NOPASSWD:ALL

Inventory#

๊ธฐ๋ณธ ์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ์€ /etc/ansible/hosts ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

all:
hosts:
<hostname>:
ansible_host: <ip|url>
children:
<group>:
hosts:
<group:hostname>:
ansible all -m ping

Playbook#

ansible-playbook <playbook>
  • -i|--inventory
  • -K|--ask-become-pass
Last updated on