Ansible: ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(publickey,password).

์— ๋งŒ๋“  2016๋…„ 12์›” 20์ผ  ยท  70์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: ansible/ansible

192.168.1.113 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n", 
    "unreachable": true
}

์ด ์˜ค๋ฅ˜๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. Virtualbox์—์„œ Debian Stretch์™€ ๊ฒŒ์ŠคํŠธ manjaro๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

affects_2.3

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์ข‹์€,
๋ช…๋ น์— all ๋ฅผ ์ง€์ •ํ•˜๋ฉด ๋””๋ฒ„๊ทธํ•˜๊ธฐ๊ฐ€ ์•ฝ๊ฐ„ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

hosts ํŒŒ์ผ์˜ ๋ชจ๋“  ํ–‰์— ์ฃผ์„์„ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค.

[webserver]
35.165.79.66 ansible_user=ubuntu 

๋‹ค์Œ์„ ์‹คํ–‰ํ•˜์‹ญ์‹œ์˜ค.

$: ansible webserver -m ping -vvv

๊ทธ๋ฆฌ๊ณ  ์ถœ๋ ฅ์„ ๋ณด์—ฌ์ฃผ์„ธ์š”.
๋ฌธ์•ˆ ์ธ์‚ฌ

๋ชจ๋“  70 ๋Œ“๊ธ€

๊ฐ™์€ ๋ฌธ์ œ์— ์ง๋ฉดํ•ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜ํ–‰์›.

๋” ๋งŽ์€ ์ถœ๋ ฅ์„ ์œ„ํ•ด -vvvv ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋™์ผํ•œ ๋ช…๋ น์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ? ์ œ๋ฐœ !

guru@tj-lp140:/etc/ansible$ ansible all -m ping -vvv
Using /etc/ansible/ansible.cfg as config file
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/system/ping.py
<35.165.79.66> ESTABLISH SSH CONNECTION FOR USER: None
<35.165.79.66> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/guru/.ansible/cp/ansible-ssh-%h-%p-%r 35.165.79.66 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1482309322.49-151682117578429 `" && echo ansible-tmp-1482309322.49-151682117578429="` echo /tmp/ansible-tmp-1482309322.49-151682117578429 `" ) && sleep 0'"'"'' 

๊ฐ์‚ฌ ํ•ด์š”.
๊ท€ํ•˜์˜ ์ถœ๋ ฅ์—์„œ โ€‹โ€‹๋‚˜๋Š” ๋‹น์‹ ์ด ์ง€์ •๋œ ansible_user ๊ฐ€ ์—†์Œ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

<35.165.79.66> ESTABLISH SSH CONNECTION FOR USER: None

๊ณ ์–‘์ด ์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ์˜ ๋‚ด์šฉ๋„ ํ‘œ์‹œํ•ฉ๋‹ˆ๊นŒ?

# This is the default ansible 'hosts' file.
#
# It should live in /etc/ansible/hosts
#
#   - Comments begin with the '#' character
#   - Blank lines are ignored
#   - Groups of hosts are delimited by [header] elements
#   - You can enter hostnames or ip addresses
#   - A hostname/ip can be a member of multiple groups

# Ex 1: Ungrouped hosts, specify before any group headers.

## green.example.com
## blue.example.com
## 192.168.100.1
## 192.168.100.10

# Ex 2: A collection of hosts belonging to the 'webservers' group

[webservers]
35.165.79.66

# If you have multiple hosts following a pattern you can specify
# them like this:

## www[001:006].example.com

# Ex 3: A collection of database servers in the 'dbservers' group

## [dbservers]
## 
## db01.intranet.mydomain.net
## db02.intranet.mydomain.net
## 10.25.1.56
## 10.25.1.57

# Here's another example of host ranges, this time there are no
# leading 0s:

## db-[99:101]-node.example.com

ssh [email protected] ์—ฐ๊ฒฐ์ด ์„ค์ •๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ฐ€๋Šฅํ•œ ๋ช…๋ น์„ ์™„๋ฃŒํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์ข‹์€,
๋ช…๋ น์— all ๋ฅผ ์ง€์ •ํ•˜๋ฉด ๋””๋ฒ„๊ทธํ•˜๊ธฐ๊ฐ€ ์•ฝ๊ฐ„ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

hosts ํŒŒ์ผ์˜ ๋ชจ๋“  ํ–‰์— ์ฃผ์„์„ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค.

[webserver]
35.165.79.66 ansible_user=ubuntu 

๋‹ค์Œ์„ ์‹คํ–‰ํ•˜์‹ญ์‹œ์˜ค.

$: ansible webserver -m ping -vvv

๊ทธ๋ฆฌ๊ณ  ์ถœ๋ ฅ์„ ๋ณด์—ฌ์ฃผ์„ธ์š”.
๋ฌธ์•ˆ ์ธ์‚ฌ

guru@tj-lp140:/etc/ansible$ ansible webservers -m ping -vvv
Using /etc/ansible/ansible.cfg as config file
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/system/ping.py
<35.165.79.66> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<35.165.79.66> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/guru/.ansible/cp/ansible-ssh-%h-%p-%r 35.165.79.66 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494 `" && echo ansible-tmp-1482312980.96-238945640414494="` echo $HOME/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494 `" ) && sleep 0'"'"''
<35.165.79.66> PUT /tmp/tmpxll2kJ TO /home/ubuntu/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494/ping.py
<35.165.79.66> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/guru/.ansible/cp/ansible-ssh-%h-%p-%r '[35.165.79.66]'
<35.165.79.66> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<35.165.79.66> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/guru/.ansible/cp/ansible-ssh-%h-%p-%r 35.165.79.66 '/bin/sh -c '"'"'chmod u+x /home/ubuntu/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494/ /home/ubuntu/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494/ping.py && sleep 0'"'"''
<35.165.79.66> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<35.165.79.66> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/guru/.ansible/cp/ansible-ssh-%h-%p-%r -tt 35.165.79.66 '/bin/sh -c '"'"'/usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494/ping.py; rm -rf "/home/ubuntu/.ansible/tmp/ansible-tmp-1482312980.96-238945640414494/" > /dev/null 2>&1 && sleep 0'"'"''
35.165.79.66 | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_name": "ping"
    }, 
    "module_stderr": "Shared connection to 35.165.79.66 closed.\r\n", 
    "module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n", 
    "msg": "MODULE FAILURE"
}
<192.168.1.113> ESTABLISH SSH CONNECTION FOR USER: fulgor
<192.168.1.113> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=fulgor -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.1.113 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1482330370.75-42265180130710 `" && echo ansible-tmp-1482330370.75-42265180130710="` echo $HOME/.ansible/tmp/ansible-tmp-1482330370.75-42265180130710 `" ) && sleep 0'"'"''
192.168.1.113 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n", 
    "unreachable": true
}

ssh ํ‚ค๊ฐ€ ์žฌ์ƒ์„ฑ๋˜๋„๋ก ๊ฐ€์ƒ ์ƒ์ž์—์„œ ์ด๋ฏธ์ง€ ๋””์Šคํฌ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์ง€๋งŒ ์ด ์ˆœ๊ฐ„๋ถ€ํ„ฐ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

๋‹น์‹ ์ด ๋‚˜๋ฅผ ๋„์šธ ์ˆ˜ ?

๋งˆ์Šคํ„ฐ ๋…ธ๋“œ์—์„œ ssh ํ‚ค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

root<strong i="6">@master</strong>:~# ssh-keygen -t rsa -C "[email protected]"

๊ทธ๋Ÿฐ ๋‹ค์Œ ssh-copy-id๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ณต๊ฐœ ํ‚ค๋ฅผ ์„œ๋ฒ„์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

root<strong i="10">@master</strong>:~# ssh-copy-id [email protected]
root<strong i="11">@master</strong>:~# ssh-copy-id [email protected]

์ด ์›น์‚ฌ์ดํŠธ https://valdhaus.co/writings/ansible-post-install/ ์—์„œ ์ด ์ •๋ณด๋ฅผ ์–ป์—ˆ๊ณ  ์ž‘๋™ ์ค‘์ž…๋‹ˆ๋‹ค.

@ guruprasad85 ์›๊ฒฉ ์‹œ์Šคํ…œ(35.165.79.66)์—์„œ "python"์ด ๋ˆ„๋ฝ๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

"module_name": "ping"
},
"module_stderr": "Shared connection to 35.165.79.66 closed.\r\n",
"module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n",
"msg": "MODULE FAILURE"
}

์•ˆ๋…•,
ํ•ด๊ฒฐ์ฑ…์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.
ami(ubuntu 16) OS๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ Python์ด ์„ค์น˜๋˜์–ด ์žˆ์ง€ ์•Š์œผ๋ฏ€๋กœ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ python์„ ์„ค์น˜ํ•˜์‹ญ์‹œ์˜ค -

sudo apt-get install python-minimal -y

๋˜๋Š”

ami(ubuntu 14) OS๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ด์ฌ 2.7์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ : ์‹œ์Šคํ…œ์— ์žˆ๋Š” OS ๋ฒ„์ „์„ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.

ํ•ด๊ฒฐ์ฑ…์„ ์ฐพ์œผ์…จ๋‹ค๋‹ˆ ๋‹คํ–‰์ž…๋‹ˆ๋‹ค.

Ansible ์ œ์–ด ์‹œ์Šคํ…œ(UBUNTU 14.04 VM์— ์„ค์น˜๋จ)์—์„œ ์„ผํŠธ OS ์ธ์Šคํ„ด์Šค๋กœ ping์„ ์‹œ๋„ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
๋‘˜ ๋‹ค google ํด๋ผ์šฐ๋“œ ์ธ์Šคํ„ด์Šค์ž…๋‹ˆ๋‹ค(python์ด ์„ค์น˜๋œ ์ƒํƒœ).
๋‚˜๋Š” ๊ทธ๋“ค ์‚ฌ์ด์˜ ์—ฐ๊ฒฐ ์ƒํƒœ์— ๋Œ€ํ•ด ํ™•์‹ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ๊ฐ€๋Šฅํ•œ all -m ping ๊ฒฐ๊ณผ์—์„œ ๋‚ด SSH์— ๋ฌธ์ œ๊ฐ€ ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

35.185.191.25 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
    "unreachable": true
# ansible all -m ping -vvv
Using /etc/ansible/ansible.cfg as config file
META: ran handlers
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/21f0e6a9ae 127.0.0.1 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
<35.185.191.25> ESTABLISH SSH CONNECTION FOR USER: gane
<35.185.191.25> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=gane -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/4596e88996 35.185.191.25 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<127.0.0.1> (255, '', 'Permission denied (publickey).\r\n')
127.0.0.1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey).\r\n",
    "unreachable": true
}
<35.185.191.25> (255, '', 'Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n')
35.185.191.25 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
    "unreachable": true
}

๋‚ด VM ๊ฐ„์˜ ์—ฐ๊ฒฐ์„ ๋‹ฌ์„ฑํ•˜๋„๋ก ์ œ์•ˆํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

@ganfotry ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€

๋‘ VM ๋ชจ๋‘์—์„œ ํ‚ค๋ฅผ ์ƒ์„ฑํ•œ ๋‹ค์Œ ํ‚ค๋ฅผ ๋ณต์‚ฌํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.
Authorized_keys ๋‚ด๋ถ€์—์„œ ๋ฐ˜๋Œ€์˜ ๊ฒฝ์šฐ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค.
๊ทธ๋•Œ ์•„๋ž˜์™€ ๊ฐ™์€ ๋‹ต๋ณ€์„ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค. :)

ansible -m ping all
127.0.0.1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
35.186.***.*** | SUCCESS => {
    "changed": false,
    "ping": "pong"

๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.

$ ansible local -m ping
127.0.0.1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n",
"unreachable": true
}

๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ sshpass๋ฅผ ์„ค์น˜ํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

sudo apt-get install sshpass

sshpass๋ฅผ ์„ค์น˜ํ•œ ํ›„ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.
` json ansible local -m ping --ask-pass SSH password: 127.0.0.1 | SUCCESS => { "changed": false, "ping": "pong" }
๋„์›€์ด ๋˜์—ˆ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค!!!

์ด๊ฒƒ์€ ๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ–ˆ์œผ๋ฏ€๋กœ ๋‹น์‹ ์—๊ฒŒ๋„ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๊ฐœ์ธ ํ‚ค๋ฅผ ํ‚ค์ฒด์ธ์— ๋“ฑ๋กํ•ด ๋ณด์‹ญ์‹œ์˜ค.

ssh-agent bash
ssh-add <path to private key>

์ด๊ฒƒ์ด ์ž‘๋™ํ•˜๋ฉด ~/.ssh/config ํŒŒ์ผ์— ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค.

์•ˆ๋…•,
๊ฐ€๋Šฅํ•œ ํƒ€์›Œ GUI ๋ชจ๋“œ์—์„œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋Š” ๋™์•ˆ ์•„๋ž˜ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

192.168.122.136 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '192.168.122.136' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,password).\r\n", 
    "unreachable": true 
}

๊ทธ๋Ÿฌ๋‚˜ ์„œ๋ฒ„์˜ CLI ๋ชจ๋“œ์—์„œ ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

[root<strong i="10">@node2</strong> ~]# ansible -m ping testservers
openstack | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

์•„๋ž˜๋Š” ์„ค๋ช…๋œ ์ถœ๋ ฅ์ž…๋‹ˆ๋‹ค.

[root<strong i="14">@node2</strong> ~]# ansible testservers -m ping -vvv
Using /etc/ansible/ansible.cfg as config file
META: ran handlers
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/ping.py
<192.168.122.136> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.122.136> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/859aa03053 192.168.122.136 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<192.168.122.136> (0, '/root\n', '')
<192.168.122.136> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.122.136> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/859aa03053 192.168.122.136 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696 `" && echo ansible-tmp-1497787246.45-142355876761696="` echo /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696 `" ) && sleep 0'"'"''
<192.168.122.136> (0, 'ansible-tmp-1497787246.45-142355876761696=/root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696\n', '')
<192.168.122.136> PUT /tmp/tmpkAYqIN TO /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696/ping.py
<192.168.122.136> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/859aa03053 '[192.168.122.136]'
<192.168.122.136> (0, 'sftp> put /tmp/tmpkAYqIN /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696/ping.py\n', '')
<192.168.122.136> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.122.136> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/859aa03053 192.168.122.136 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696/ /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696/ping.py && sleep 0'"'"''
<192.168.122.136> (0, '', '')
<192.168.122.136> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.122.136> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/859aa03053 -tt 192.168.122.136 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696/ping.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1497787246.45-142355876761696/" > /dev/null 2>&1 && sleep 0'"'"''
<192.168.122.136> (0, '\r\n{"invocation": {"module_args": {"data": null}}, "changed": false, "ping": "pong"}\r\n', 'Shared connection to 192.168.122.136 closed.\r\n')
openstack | SUCCESS => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "data": null
        }
    }, 
    "ping": "pong"
}
META: ran handlers
META: ran handlers

๊ฐ์‚ฌ ํ•ด์š”

ํ„ฐ๋ฏธ๋„์˜ ์„œ๋ฒ„์— ์ˆ˜๋™์œผ๋กœ ์•ก์„ธ์Šค๋ฅผ ์‹œ๋„ํ•˜๊ณ  ์›๊ฒฉ ์„œ๋ฒ„์— sshํ•  ์ˆ˜ ์žˆ์œผ๋ฉด ๋กœ์ปฌ ์‚ฌ์šฉ์ž์˜ ํ™ˆ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ .ansible ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ œ๊ฑฐํ•˜์‹ญ์‹œ์˜ค. ์ด๊ฒƒ์€ ๋‚˜๋ฅผ ์œ„ํ•ด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. (์™€์ด)

๋‚˜๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์•ผ!
-i ์ง€์‹œ๋ฌธ์„ ์ „๋‹ฌํ•˜์ง€ ์•Š๊ณ  ํ„ฐ๋ฏธ๋„์„ ํ†ตํ•ด ์„œ๋ฒ„๋ฅผ sshํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ssh [email protected]

๊ณต์žฅ

๋ช…๋ น ์‹คํ–‰:

ansible all -m ping

์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

    "msg": "Failed to connect to the host via ssh: Permission denied (publickey).\r\n",  
    "unreachable": true

@lkjangir ์ œ๊ฑฐ .ansible ๋””๋ ‰ํ† ๋ฆฌ๋„ ์ž‘๋™ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. =(

์ด๊ฒƒ์„ ์‹œ๋„ํ•˜๊ณ  ec2-user๋ฅผ ์„ค์ •ํ•œ ์‚ฌ์šฉ์ž ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊พธ์‹ญ์‹œ์˜ค.

ansible all -u ec2-user -m ping -vvv

@aelkz :์€ / etc / ansible / hosts ํŒŒ์ผ์—์„œ, ๋‹น์‹ ์€ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค : [email protected] ๋Œ€์‹  server.com ๋‹ค์Œ ์‹œ๋„ ansible all -m ping .
๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด /etc/ansible/hosts์— user1์„ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ansible ๋ช…๋ น์— ์‚ฌ์šฉ์ž๋ฅผ ์ง€์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ansible all -m ping -u user1
๋‚˜๋Š” ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ์žˆ์—ˆ๊ณ  ๊ทธ ์†”๋ฃจ์…˜์œผ๋กœ ๋‚ด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋‚ด๊ฐ€ ํ‹€๋ฆฌ์ง€ ์•Š๋‹ค๋ฉด ์ด๊ฒƒ์€ ssh ํ‚ค ๋ฌธ์ œ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ์ƒˆ ํ‚ค๋ฅผ ๊ฐฑ์‹ ํ•˜๊ฑฐ๋‚˜ ์˜ค๋ฅ˜๋ฅผ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ํ‚ค๋ฅผ openssh ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•˜์‹ญ์‹œ์˜ค.

--ask-pass๋ฅผ -u ๋งค๊ฐœ๋ณ€์ˆ˜์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋ฉด ํšจ๊ณผ์ ์ด์—ˆ์Šต๋‹ˆ๋‹ค.

@Hai-minhD ๊ท€ํ•˜์˜ ์†”๋ฃจ์…˜์ด ์ €์—๊ฒŒ ํšจ๊ณผ์ ์ด์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋‚˜๋Š” ์ œ์–ด ์‹œ์Šคํ…œ์—์„œ ์‚ฌ์šฉํ•˜๋˜ ๋™์ผํ•œ ์‚ฌ์šฉ์ž์™€ ๋ฃจํŠธ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ๋Š” ํ˜ธ์ŠคํŠธ์—์„œ ํ…Œ์ŠคํŠธํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์œ„์—์„œ ๋ณด๊ณ ๋œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ ์ด ํŠน์ • ํ˜ธ์ŠคํŠธ์—๋Š” ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. Ansible ํ˜ธ์ŠคํŠธ ํŒŒ์ผ: username@host์— ์ด ์‚ฌ์šฉ์ž ์ด๋ฆ„์ด ์žˆ๋Š” ํ˜ธ์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค

๋…ธ๋ ฅํ•˜๋‹ค-

์•ค์„œ๋ธ” ์›น์„œ๋ฒ„ -m ping --ask-pass -i path_to_local_hosts_file

์Šฌ๋ ˆ์ด๋ธŒ์— python์„ ์„ค์น˜ํ–ˆ๋Š”๋ฐ ์ €์—๊ฒŒ ํšจ๊ณผ์ ์ด์—ˆ์Šต๋‹ˆ๋‹ค.

๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.
์†”๋ฃจ์…˜์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. /etc/ansible/hosts๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
ansible_ssh_user=๊ฐ€๋Šฅ_ssh_pass=.

๋„์›€์ด ๋˜์—ˆ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ shivslave๋Š” IP๊ฐ€ 192.168.0.5์ธ Virtualbox์˜ ๋˜ ๋‹ค๋ฅธ VM์ด๋ฉฐ [email protected] ์™€ ์„ฑ๊ณต์ ์œผ๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์ง€๋งŒ Ansible ๋ช…๋ น์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์—๋Š” ๋‹ค์Œ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

[์˜ˆ์‹œ]192.168.0.5

shivmaster@shivmaster-VirtualBox :~$ ๊ฐ€๋Šฅํ•œ ์˜ˆ -m ping -u shivslave -vvv
์•ค์„œ๋ธ” 2.4.1.0
์„ค์ • ํŒŒ์ผ = /etc/ansible/ansible.cfg
๊ตฌ์„ฑ๋œ ๋ชจ๋“ˆ ๊ฒ€์ƒ‰ ๊ฒฝ๋กœ = [u'/home/shivmaster/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
์•ค์„œ๋ธ” ํŒŒ์ด์ฌ ๋ชจ๋“ˆ ์œ„์น˜ = /usr/lib/python2.7/dist-packages/ansible
์‹คํ–‰ ์œ„์น˜ = /usr/bin/ansible
ํŒŒ์ด์ฌ ๋ฒ„์ „ = 2.7.6(๊ธฐ๋ณธ๊ฐ’, 2016๋…„ 10์›” 26์ผ, 20:30:19) [GCC 4.8.4]
/etc/ansible/ansible.cfg๋ฅผ ์„ค์ • ํŒŒ์ผ๋กœ ์‚ฌ์šฉ
ini ํ”Œ๋Ÿฌ๊ทธ์ธ์œผ๋กœ /etc/ansible/hosts ์ธ๋ฒคํ† ๋ฆฌ ์†Œ์Šค ๊ตฌ๋ฌธ ๋ถ„์„
META: ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.
๋ชจ๋“ˆ ํŒŒ์ผ ์‚ฌ์šฉ /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
<192.168.0.5> ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: shivslave
<192.168.0.5> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ์‚ฌ์šฉ์ž=shivslave -o ConnectTimeout=10 -o ControlPath=/home/shivmaster/.ansible/cp/e51c1eb9be 192.168.0.5 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<192.168.0.5> (255, '', '๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœํ‚ค,๋น„๋ฐ€๋ฒˆํ˜ธ).\r\n')
192.168.0.5 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค, ์•”ํ˜ธ).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}
shivmaster@shivmaster-VirtualBox :~$

@lktslionel
๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์œ„์—์„œ ์–ธ๊ธ‰ํ•œ ๋ชจ๋“  ์˜ต์…˜์„ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—์„œ ๋„์™€์ฃผ์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?

์•ค์„œ๋ธ” 2.4.2.0
์„ค์ • ํŒŒ์ผ = /etc/ansible/ansible.cfg
๊ตฌ์„ฑ๋œ ๋ชจ๋“ˆ ๊ฒ€์ƒ‰ ๊ฒฝ๋กœ = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
์•ค์„œ๋ธ” ํŒŒ์ด์ฌ ๋ชจ๋“ˆ ์œ„์น˜ = /usr/lib/python2.7/dist-packages/ansible
์‹คํ–‰ ์œ„์น˜ = /usr/bin/ansible
ํŒŒ์ด์ฌ ๋ฒ„์ „ = 2.7.12(๊ธฐ๋ณธ๊ฐ’, 2017๋…„ 11์›” 20์ผ, 18:23:56) [GCC 5.4.0 20160609]
/etc/ansible/ansible.cfg๋ฅผ ์„ค์ • ํŒŒ์ผ๋กœ ์‚ฌ์šฉ
ansible.cfg์—์„œ deprecation_warnings=False๋ฅผ ์„ค์ •ํ•˜์—ฌ ๋น„ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ธ๋ฒคํ† ๋ฆฌ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์ •
ini ํ”Œ๋Ÿฌ๊ทธ์ธ์œผ๋กœ /etc/ansible/hosts ์ธ๋ฒคํ† ๋ฆฌ ์†Œ์Šค ๊ตฌ๋ฌธ ๋ถ„์„
/usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc์—์„œ stdout v2.0 ์œ ํ˜•์˜ ์ตœ์†Œ ์ฝœ๋ฐฑ ํ”Œ๋Ÿฌ๊ทธ์ธ ๋กœ๋“œ
META: ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.
๋ชจ๋“ˆ ํŒŒ์ผ ์‚ฌ์šฉ /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
<10.0.3.36> ์‚ฌ์šฉ์ž์— ๋Œ€ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: ๋ฃจํŠธ
<10.0.3.36> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi- keyex, hostbased, publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/c8171a76d6 10.0.3.36 '/bin/sh -c '"'"'echo ~ && ์ ˆ์ „ 0'"'"''
<10.0.3.36> (255, '', 'OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 2016๋…„ 3์›” 1์ผ\r\ndebug1: ๊ตฌ์„ฑ ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ /etc/ssh/ssh_config\r\ndebug1: /etc/ ssh/ssh_config ํ–‰ 19: \r\ndebug1์— ๋Œ€ํ•œ ์˜ต์…˜ ์ ์šฉ sh/id_dsa-cert ์œ ํ˜• -1\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ecdsa ์œ ํ˜• 3\r\ndebug1: key_load_public: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ecdsa -cert ์œ ํ˜• -1\r\ndebug1: key_load_public: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ed25519 ์œ ํ˜• -1\r\ndebug1: key_load_public: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\ndebug1 : ID ํŒŒ์ผ /root/.ssh/id_ed25519-cert ์œ ํ˜• -1\r\ndebug1: ํ”„๋กœํ† ์ฝœ 2.0์— ๋Œ€ํ•œ ํ˜ธํ™˜์„ฑ ๋ชจ๋“œ ํ™œ์„ฑํ™”\r\ndebug1: ๋กœ์ปฌ ๋ฒ„์ „ ๋ฌธ์ž์—ด SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2\r\ndebug1 : ์›๊ฒฉ ํ”„๋กœํ† ์ฝœ ๋ฒ„์ „ 2.0, ์›๊ฒฉ ์†Œํ”„ํŠธ์›จ์–ด ๋ฒ„์ „ OpenSSH_7.2p2 Ubuntu-4ubuntu2.2\r\ndebug1: ์ผ์น˜: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH compat 0x04000000\r\ndebug2: fd 3 ์„ค์ • O_NONBLOCK\r\n 10.0.3.36:22์— \'root\'\r\ndebug3: hostkeys_foreach: ์ฝ๊ธฐ ํŒŒ์ผ "/root/.ssh/known_hosts"\r\ndebug3: record_hostkey: /root/.ssh/ ํŒŒ์ผ์—์„œ ํ‚ค ์œ ํ˜• ECDSA๋ฅผ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. known_hosts:1\r\ndebug3: load_hostkeys: 10.0์—์„œ 1๊ฐœ์˜ ํ‚ค๋ฅผ ๋กœ๋“œํ–ˆ์Šต๋‹ˆ๋‹ค. .3.36\r\ndebug3: order_hostkeyalgs: hostkeyalgs ์„ ํ˜ธ: [email protected],[email protected],ecdsa-sha2-nistp011@cert-v openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\r\ndebug3: ํŒจํ‚ท ์ „์†ก: ์œ ํ˜• 20\r\ndebug1: SSH2_MSG_KEXINIT ์ „์†ก\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 20\r \ndebug1: SSH2_MSG_KEXINIT ์ˆ˜์‹ \r\ndebug2: ๋กœ์ปฌ ํด๋ผ์ด์–ธํŠธ KEXINIT ์ œ์•ˆ\r\ndebug2: KEX ์•Œ๊ณ ๋ฆฌ์ฆ˜: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp384,ecdh-sha2- hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,ext-info-c\r\ndebug2: ํ˜ธ์ŠคํŠธ ํ‚ค ์•Œ๊ณ ๋ฆฌ์ฆ˜: ecdsa-sha2-nistp256-cert-v01@ openssh.com,[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp52 [email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa\r\ndebug2: ์•”ํ˜ธ ctos : ์ฐจ์ฐจ20ํฌ [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes3des-cbc\, r\ndebug2: ์•”ํ˜ธ stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128- ,aes256-cbc,3des-cbc\r\ndebug2: MAC ctos: [email protected],[email protected],[email protected],hmac- [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac- sha1\r\ndebug2: MAC ์Šคํ†ก: [email protected],[email protected],[email protected],hmac-sha2-512-etm@openssh .com,[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: ์••์ถ• ctos: [email protected],zlib,none\r\ndebug2: ์••์ถ• stoc: [email protected],zlib,none\r\ndebug2: ์–ธ์–ด ctos: \r\ndebug2: ์–ธ์–ด stoc: \r\ndebug2: first_kex_follows 0 \r\n๋””๋ฒ„๊ทธ2: r eserved 0 \r\ndebug2: ํ”ผ์–ด ์„œ๋ฒ„ KEXINIT ์ œ์•ˆ\r\ndebug2: KEX ์•Œ๊ณ ๋ฆฌ์ฆ˜: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman -exchange-sha256,diffie-hellman-group14-sha1\r\ndebug2: ํ˜ธ์ŠคํŠธ ํ‚ค ์•Œ๊ณ ๋ฆฌ์ฆ˜: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519\r\ndebug2 : ์•”ํ˜ธ ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]\r\ndebug2: polychapherscha05 @openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]\r\ndebug2: MAC ctos: [email protected], [email protected],[email protected],[email protected],[email protected],umac-64@openssh. com,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: MAC ์Šคํ†ก: [email protected],umac-128-etm@openssh .com,[email protected],[email protected],[email protected],umac-64@open ssh.com,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: ์••์ถ• ctos: ์—†์Œ,[email protected]\r\ndebug2: ์••์ถ• ์Šคํ†ก: ์—†์Œ,[email protected]\r\ndebug2: ์–ธ์–ด ctos: \r\ndebug2: ์–ธ์–ด stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: ์˜ˆ์•ฝ๋œ 0 \r\ndebug1: kex: ์•Œ๊ณ ๋ฆฌ์ฆ˜: curve25519-sha256@ libssh.org\r\ndebug1: kex: ํ˜ธ์ŠคํŠธ ํ‚ค ์•Œ๊ณ ๋ฆฌ์ฆ˜: ecdsa-sha2-nistp256\r\ndebug1: kex: ์„œ๋ฒ„->ํด๋ผ์ด์–ธํŠธ ์•”ํ˜ธ: [email protected] MAC:์••์ถ•: [email protected]\r\ndebug1: kex: ํด๋ผ์ด์–ธํŠธ->์„œ๋ฒ„ ์•”ํ˜ธ: [email protected] MAC:์••์ถ•: [email protected]\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 30\r\ndebug1: SSH2_MSG_KEX_ECDH_REPLY ์˜ˆ์ƒ\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 31\r\ndebug1: ์„œ๋ฒ„ ํ˜ธ์ŠคํŠธ ํ‚ค: ecdsa-sha2-nistp256 SHA256: JDiSsUdyRJfRGvtqAURzMtKu/Ghp0adBt/l9VbvgDfg\r\ndebug3: hostkeys_foreach: "/root/.ssh/known_hosts" ํŒŒ์ผ ์ฝ๊ธฐ\r\ndebug3: record_hostkey: /root/.ssh1\rknown_ํŒŒ์ผ์—์„œ ECDSA ํ‚ค ์œ ํ˜•์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. load_hostkeys: 10.0.3.36์—์„œ ๋กœ๋“œ๋œ 1๊ฐœ์˜ ํ‚ค\r\ndebug1: ํ˜ธ์ŠคํŠธ \'10.0.3.36\'์ด(๊ฐ€) ์•Œ๋ ค์ ธ ์žˆ์œผ๋ฉฐ ECDSA ํ˜ธ์ŠคํŠธ ํ‚ค์™€ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค.\r\ndebug1: /root/.ssh/known_hosts:1์—์„œ ํ‚ค๋ฅผ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.\r \n๋””๋ฒ„๊ทธ3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 21\r\n๋””๋ฒ„๊ทธ2: set_newkeys: ๋ชจ๋“œ 1\r\n๋””๋ฒ„๊ทธ1: 134217728 ๋ธ”๋ก ํ›„ ๋‹ค์‹œ ํ‚ค\r\n๋””๋ฒ„๊ทธ1: SSH2_MSG_NEWKEYS ์ „์†ก\r\n๋””๋ฒ„๊ทธ1: SSH2_MSG_NEWKEY321 ์ˆ˜์‹  ์˜ˆ์ƒ\r\n๋””๋ฒ„๊ทธ ์œ ํ˜• \r\ndebug2: set_newkeys: ๋ชจ๋“œ 0\r\ndebug1: 134217728 ๋ธ”๋ก ํ›„ ๋‹ค์‹œ ํ‚ค\r\ndebug1: SSH2_MSG_NEWKEYS ์ˆ˜์‹ \r\ndebug2: ํ‚ค: /root/.ssh/id_ecdsa(0x55cbdc34d840) ๋””๋ฒ„๊ทธ : /root/.ssh/id_rsa(0x55cbdc33fc30)\r\n๋””๋ฒ„๊ทธ 2: ํ‚ค: /root/.ssh/id_dsa ((nil))\r\ndebug2: ํ‚ค: /root/.ssh/id_ed25519 ((nil))\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 5\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 7\r\ndebug1: SSH2_MSG_EXT_INFO ์ˆ˜์‹ \r\ndebug1: kex_input_ext_info: server-sig-algs=\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 6\r\ndebug2: service_accept: ssh-userauth\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT ์ˆ˜์‹ \r\ndebug3: ํŒจํ‚ท ์ „์†ก: ์œ ํ˜• 50\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 51\r\ ndebug1: ๊ณ„์†ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ: publickey,password\r\ndebug3: ๋‹ค์‹œ ์‹œ์ž‘, ๋‹ค๋ฅธ ๋ชฉ๋ก์„ ์ „๋‹ฌ publickey,password\r\ndebug3: ๊ธฐ๋ณธ gssapi-with-mic,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_lookup publickey\r\ndebug3: ๋‚˜๋จธ์ง€ ๊ธฐ๋ณธ ์„ค์ •: ,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_is_enabled publickey\r\ndebug1: ๋‹ค์Œ ์ธ์ฆ ๋ฐฉ๋ฒ•: publickey\r\ndebug1: ECDSA ๊ณต๊ฐœ ํ‚ค ์ œ๊ณต: /root/.ssh/ id_ecdsa\r\ndebug3: send_pubkey_test\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 50\r\ndebug2: ๊ณต๊ฐœ ํ‚ค ํŒจํ‚ท์„ ๋ณด๋ƒˆ์Šต๋‹ˆ๋‹ค. ์‘๋‹ต์„ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค.\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 51\r\ndebug1: ๊ณ„์†ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ : publickey,password\r\ndebug1: RSA ๊ณต๊ฐœ ํ‚ค ์ œ๊ณต: /root/.ssh/id_rsa\r\ndebug3: send_pubkey_test\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 50\r\ndebug2: ๊ณต๊ฐœ ํ‚ค๋ฅผ ๋ณด๋ƒˆ์Šต๋‹ˆ๋‹ค. ํŒจํ‚ท, ์‘๋‹ต ๋Œ€๊ธฐ\r\n๋””๋ฒ„๊ทธ3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 51\r\ndebug1: ๊ณ„์†ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ: publickey,password\r\ndebug1: ๊ฐœ์ธ ํ‚ค ์‹œ๋„: /root/.ssh/id_dsa\r\ndebug3: ์•„๋‹ˆ์š” ์ด๋Ÿฌํ•œ ID: /root/.ssh/id_dsa: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\ndebug1: ๊ฐœ์ธ ํ‚ค ์‹œ๋„ ์ค‘: /root/.ssh/id_ed25519\r\ndebug3: ํ•ด๋‹น ID๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค: /root/.ssh/id_ed25519: ์•„๋‹ˆ์š” ์ด๋Ÿฌํ•œ ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ\r\n๋””๋ฒ„๊ทธ2: ํŒจํ‚ท์„ ๋ณด๋‚ด์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๋ฐฉ๋ฒ•์„ ๋น„ํ™œ์„ฑํ™”\r\n๋””๋ฒ„๊ทธ1: ๋” ์ด์ƒ ์‹œ๋„ํ•  ์ธ์ฆ ๋ฐฉ๋ฒ•์ด ์—†์Šต๋‹ˆ๋‹ค.\r\n๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค, ์•”ํ˜ธ).\r\n')
10.0.3.36 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 2016๋…„ 3์›” 1์ผ\r\ndebug1: ๊ตฌ์„ฑ ๋ฐ์ดํ„ฐ ์ฝ๊ธฐ /etc/ssh/ssh_config\r\ndebug1: / etc/ssh/ssh_config ํ–‰ 19: \r\ndebug1์— ๋Œ€ํ•œ ์˜ต์…˜ ์ ์šฉ bug1: ID ํŒŒ์ผ /root/.ssh/id_dsa-cert ์œ ํ˜• -1\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ecdsa ์œ ํ˜• 3\r\ndebug1: key_load_public: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ecdsa-cert ์œ ํ˜• -1\r\ndebug1: key_load_public: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ ์—†์Œ\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ed25519 ์œ ํ˜• -1\r\ndebug1: key_load_public: ์•„๋‹ˆ์š” ์ด๋Ÿฌํ•œ ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ\r\ndebug1: ID ํŒŒ์ผ /root/.ssh/id_ed25519-cert ์œ ํ˜• -1\r\ndebug1: ํ”„๋กœํ† ์ฝœ 2.0์— ๋Œ€ํ•œ ํ˜ธํ™˜์„ฑ ๋ชจ๋“œ ํ™œ์„ฑํ™”\r\ndebug1: ๋กœ์ปฌ ๋ฒ„์ „ ๋ฌธ์ž์—ด SSH-2.0-OpenSSH_7.2p2 Ubuntu -4ubuntu2.2\r\ndebug1: ์›๊ฒฉ ํ”„๋กœํ† ์ฝœ ๋ฒ„์ „ 2.0, ์›๊ฒฉ ์†Œํ”„ํŠธ์›จ์–ด ๋ฒ„์ „ OpenSSH_7.2p2 Ubuntu-4ubuntu2.2\r\ndebug1: ์ผ์น˜: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH ํ˜ธํ™˜ 0x04000000\r\ndebug 3 ์„ค์ • O_NONBLOCK\r\ndebug1: 10.0.3.36:22์— '๋ฃจํŠธ'๋กœ ์ธ์ฆ\r\ndebug3: hostkeys_foreach: ํŒŒ์ผ ์ฝ๊ธฐ \"/root/.ssh/known_hosts\"\r\ndebug3: record_hostkey: ํ‚ค ์œ ํ˜• ECDSA๋ฅผ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. ํŒŒ์ผ /root/.ssh/known_hosts:1\r\ndebug3: load_hostk eys: 10.0.3.36์—์„œ ๋กœ๋“œ๋œ ํ‚ค 1๊ฐœ\r\ndebug3: order_hostkeyalgs: hostkeyalgs ์„ ํ˜ธ: [email protected],[email protected],ecdsa-sha2 [email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\r\ndebug3: ํŒจํ‚ท ์ „์†ก: ์œ ํ˜• 20\r\ndebug1: SSH2_MSG_KEXINIT ์ „์†ก๋จ\r ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 20\r\ndebug1: SSH2_MSG_KEXINIT ์ˆ˜์‹ \r\ndebug2: ๋กœ์ปฌ ํด๋ผ์ด์–ธํŠธ KEXINIT ์ œ์•ˆ\r\ndebug2: KEX ์•Œ๊ณ ๋ฆฌ์ฆ˜: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp38 -sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,ext-info-c\r\ndebug2: ํ˜ธ์ŠคํŠธ ํ‚ค ์•Œ๊ณ ๋ฆฌ์ฆ˜: ecdsa-sha2 [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp3 ,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa \r\n๋””๋ฒ„๊ทธ 2: ์•”ํ˜ธ ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,cbcaes -cbc,3des-cbc\r\ndebug2: ์•”ํ˜ธ stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],aes256.gcm@openssh aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc\r\ndebug2: MAC ctos: [email protected],[email protected],hmac-sha2-256-etm @openssh.com,[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac -sha2-512,hmac-sha1\r\ndebug2: MAC ์Šคํ†ก: [email protected],[email protected],[email protected],hmac- [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac- sha1\r\ndebug2: ์••์ถ• ctos: [email protected],zlib,none\r\ndebug2: ์••์ถ• stoc: [email protected],zlib,none\r\ndebug2: ์–ธ์–ด ctos: \r\ndebug2: ์–ธ์–ด stoc : \r\ndebug2: ์ฒซ ๋ฒˆ์งธ _kex_follows 0 \r\ndebug2: ์˜ˆ์•ฝ 0 \r\ndebug2: ํ”ผ์–ด ์„œ๋ฒ„ KEXINIT ์ œ์•ˆ\r\ndebug2: KEX ์•Œ๊ณ ๋ฆฌ์ฆ˜: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,-ecd nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1\r\ndebug2: ํ˜ธ์ŠคํŠธ ํ‚ค ์•Œ๊ณ ๋ฆฌ์ฆ˜: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256, ssh-ed25519\r\ndebug2: ์•”ํ˜ธ ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],aes256-gcm@r\sndebug2 : ์•”ํ˜ธ ์Šคํ†ก: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]\r\ndebug2: MACs-ctos: [email protected],[email protected],[email protected],[email protected],[email protected] ,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: MAC ์Šคํ†ก: [email protected], [email protected],[email protected],[email protected],hmac-sha1- [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: ์••์ถ• ctos: ์—†์Œ,zlib@openssh .com\r\ndebug2: ์••์ถ• stoc: ์—†์Œ,[email protected]\r\ndebug2: ์–ธ์–ด ctos: \r\ndebug2: ์–ธ์–ด stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: ์˜ˆ์•ฝ๋œ 0 \r\ ndebug1: kex: ์•Œ๊ณ ๋ฆฌ์ฆ˜: [email protected]\r\ndebug1: kex: ํ˜ธ์ŠคํŠธ ํ‚ค ์•Œ๊ณ ๋ฆฌ์ฆ˜: ecdsa-sha2-nistp256\r\ndebug1: kex: ์„œ๋ฒ„->ํด๋ผ์ด์–ธํŠธ ์•”ํ˜ธ: [email protected] MAC :์••์ถ•: [email protected]\r\ndebug1: kex: ํด๋ผ์ด์–ธํŠธ->์„œ๋ฒ„ ์•”ํ˜ธ: [email protected] MAC:์••์ถ•: [email protected]\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 30\r\ndebug1: SSH2_MSG_KEX_ECDH_REPLY ์˜ˆ์ƒ\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 31\r\ndebug1: ์„œ๋ฒ„ ํ˜ธ์ŠคํŠธ ํ‚ค: ecdsa-sha2-nistp256 SHA256: JDiSsUdyRJfRGvtqAURzMtKu/Ghp0adBt/l9VbvgDfg\r\ndebug3: hostkeys_foreach: ์ฝ๊ธฐ ํŒŒ์ผ \"/root/.ssh/known_hosts\"\r\ndebug3: record_hostkey: /root/.ssh/์•Œ๋ ค์ง„ ํŒŒ์ผ์—์„œ ECDSA ํ‚ค ์œ ํ˜•์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. ndebug3: load_hostkeys: 10.0.3.36์—์„œ ๋กœ๋“œ๋œ 1๊ฐœ์˜ ํ‚ค\r\ndebug1: ํ˜ธ์ŠคํŠธ '10.0.3.36'์ด ์•Œ๋ ค์ ธ ์žˆ์œผ๋ฉฐ ECDSA ํ˜ธ์ŠคํŠธ ํ‚ค์™€ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค.\r\ndebug1: /root/.ssh/known_hosts:1์—์„œ ํ‚ค๋ฅผ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.\r \n๋””๋ฒ„๊ทธ3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 21\r\n๋””๋ฒ„๊ทธ2: set_newkeys: ๋ชจ๋“œ 1\r\n๋””๋ฒ„๊ทธ1: 134217728 ๋ธ”๋ก ํ›„ ํ‚ค ์žฌ์ž…๋ ฅ\r\n๋””๋ฒ„๊ทธ1: SSH2_MSG_NEWKEYS ์ „์†ก\r\n๋””๋ฒ„๊ทธ1: SSH2_MSG_NEWKEY321 ์ˆ˜์‹  ์˜ˆ์ƒ\r\n๋””๋ฒ„๊ทธ ์œ ํ˜• \r\ndebug2: set_newkeys: ๋ชจ๋“œ 0\r\ndebug1: 134217728 ๋ธ”๋ก ํ›„ ๋‹ค์‹œ ํ‚ค\r\ndebug1: SSH2_MSG_NEWKEYS ์ˆ˜์‹ \r\ndebug2: ํ‚ค: /root/.ssh/id_ecdsa(0x55cbdc34d840) ๋””๋ฒ„๊ทธ : /root/.ssh/id_rsa(0x55cbdc33fc30)\r\n๋””๋ฒ„๊ทธ 2: ํ‚ค: /root/.ssh/id_dsa ((nil))\r\ndebug2: ํ‚ค: /root/.ssh/id_ed25519 ((nil))\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 5\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 7\r\ndebug1: SSH2_MSG_EXT_INFO ์ˆ˜์‹ \r\ndebug1: kex_input_ext_info: server-sig-algs=\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 6\r\ndebug2: service_accept: ssh-userauth\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT ์ˆ˜์‹ \r\ndebug3: ํŒจํ‚ท ์ „์†ก: ์œ ํ˜• 50\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 51\r\ ndebug1: ๊ณ„์†ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ: publickey,password\r\ndebug3: ๋‹ค์‹œ ์‹œ์ž‘, ๋‹ค๋ฅธ ๋ชฉ๋ก์„ ์ „๋‹ฌ publickey,password\r\ndebug3: ๊ธฐ๋ณธ gssapi-with-mic,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_lookup publickey\r\ndebug3: ๋‚˜๋จธ์ง€ ๊ธฐ๋ณธ ์„ค์ •: ,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_is_enabled publickey\r\ndebug1: ๋‹ค์Œ ์ธ์ฆ ๋ฐฉ๋ฒ•: publickey\r\ndebug1: ECDSA ๊ณต๊ฐœ ํ‚ค ์ œ๊ณต: /root/.ssh/ id_ecdsa\r\ndebug3: send_pubkey_test\r\ndebug3: ํŒจํ‚ท ์ „์†ก: ์œ ํ˜• 50\r\ndebug2: ๊ณต๊ฐœ ํ‚ค ํŒจํ‚ท์„ ๋ณด๋ƒˆ์Šต๋‹ˆ๋‹ค. ์‘๋‹ต์„ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค.\r\ndebug3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 51\r\ndebug1: ๊ณ„์†ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ : publickey,password\r\ndebug1: RSA ๊ณต๊ฐœ ํ‚ค ์ œ๊ณต: /root/.ssh/id_rsa\r\ndebug3: send_pubkey_test\r\ndebug3: ํŒจํ‚ท ๋ณด๋‚ด๊ธฐ: ์œ ํ˜• 50\r\ndebug2: ๊ณต๊ฐœ ํ‚ค๋ฅผ ๋ณด๋ƒˆ์Šต๋‹ˆ๋‹ค. ํŒจํ‚ท, ์‘๋‹ต ๋Œ€๊ธฐ\r\n๋””๋ฒ„๊ทธ3: ํŒจํ‚ท ์ˆ˜์‹ : ์œ ํ˜• 51\r\ndebug1: ๊ณ„์†ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ: publickey,password\r\ndebug1: ๊ฐœ์ธ ํ‚ค ์‹œ๋„: /root/.ssh/id_dsa\r\ndebug3: ์•„๋‹ˆ์š” ์ด๋Ÿฌํ•œ ID: /root/.ssh/id_dsa: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\ndebug1: ๊ฐœ์ธ ํ‚ค ์‹œ๋„ ์ค‘: /root/.ssh/id_ed25519\r\ndebug3: ํ•ด๋‹น ID๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค: /root/.ssh/id_ed25519: ์•„๋‹ˆ์š” ์ด๋Ÿฌํ•œ ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ\r\n๋””๋ฒ„๊ทธ2: ํŒจํ‚ท์„ ๋ณด๋‚ด์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๋ฐฉ๋ฒ•์„ ๋น„ํ™œ์„ฑํ™”\r\n๋””๋ฒ„๊ทธ1: ๋” ์ด์ƒ ์ธ์ฆ ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.\r\n๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค, ์•”ํ˜ธ).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}
root@ip-172-31-31-140:~/.ssh#

๋‚˜๋Š” ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๊ณ  ํ˜„์žฌ ์‚ฌ์šฉ์ž ์ด๋ฆ„์„ ์‚ฌ์šฉํ•˜์—ฌ ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•˜๋ฏ€๋กœ ๋‚ด ๋ฐฉ๋ฒ•์€ ์‚ฌ์šฉ์ž ์ด๋ฆ„์„ ๋ฎ์–ด์“ฐ๋Š” ๊ฒƒ์ด์—ˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
ansible all -m ping -u ec2-user

'ansible all -m ping'์„ ์‹คํ–‰ํ•˜๋Š” ๋™์•ˆ ๋‘ ๊ฐ€์ง€ ์˜ค๋ฅ˜์— ์ง๋ฉดํ–ˆ๊ณ  ์ด ์Šค๋ ˆ๋“œ์—์„œ t-shoot๋ฅผ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ์ดํ•ดํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋œ ์˜๊ฒฌ์— ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

:์˜ค๋ฅ˜-1:
์ด ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๋‹จ๊ณ„: "msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค, ์•”ํ˜ธ).\r\n"
1) ์ ์ ˆํ•œ ์‚ฌ์šฉ์ž ์ด๋ฆ„ 'ubuntu'๋ฅผ ํฌํ•จํ•˜๋„๋ก /etc/ansible/hosts์—์„œ ์ˆ˜์ • ๊ตฌ์„ฑ ํŒŒ์ผ์„ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
2) '--private-key=/Users/my-user/.ssh/my-key.pem' ์ธ์ˆ˜๋ฅผ ์ „๋‹ฌํ•˜๋ฏ€๋กœ ๋ช…๋ น์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๋ชจ๋“  ๊ฐ€๋Šฅ -m ping --private-key=/Users/my-user/.ssh/my-key.pem
์ด ๊ฐ€์ด๋“œ์—์„œ๋Š” ํ‚ค๋ฅผ ์ธ์ˆ˜๋กœ ์ „๋‹ฌํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์„ค๋ช…ํ–ˆ์Šต๋‹ˆ๋‹ค.
https://ansible-tips-and-tricks.readthedocs.io/en/latest/ansible/commands/

:์˜ค๋ฅ˜ 2:
"module_stdout": "/bin/sh: 1: /usr/bin/python: ์ฐพ์„ ์ˆ˜ ์—†์Œ\r\n",
์ˆ˜์ •ํ•˜๊ธฐ ์œ„ํ•ด 'sudo apt-get update; ์›๊ฒฉ ํ˜ธ์ŠคํŠธ์— sudo apt-get install python'. ec2 ์ธ์Šคํ„ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ๋กœ ์‹œ์ž‘ ์Šคํฌ๋ฆฝํŠธ์˜ ์ผ๋ถ€๋กœ ์„ค์น˜ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ๋‘ ๋ฒˆ์งธ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.

๊ฑด๋ฐฐ!

Ubuntu 16.04 ์„œ๋ฒ„์— python์ด ์—†๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ์›๊ฒฉ ํ˜ธ์ŠคํŠธ์— ์„ค์น˜ํ–ˆ๋Š”๋ฐ ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
sudo apt-get install python-minimal -y

SSH๋Š” ํ„ฐ๋ฏธ๋„๊ณผ ์—ฐ๊ฒฐ๋˜์ง€๋งŒ vsts ๋ฐsible๊ณผ๋Š” ์—ฐ๊ฒฐ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๋„ ๋‚˜๋ฅผ ๋„์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

* @10.130.2.142:22์— SSH ์—ฐ๊ฒฐ์„ ์„ค์ •ํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
2018-04-04T21:56:46.6533908Z
2018-04-04T21 : 56 : 46.6549162Z์˜ PLAY [๋ชจ๋“  * * * * * * * * * * * * * * * * * * * * *
2018-04-04T21:56:46.6555625Z
2018-04-04T21:56:46.6603308Z
2018-04-04T21:56:46.6616154Z TASK [๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ] * * * * * * * * * * * * * * * *
2018-04-04T21:56:46.6622522Z
2018-04-04T21:56:46.8874071Z ์‹คํŒจ: [10.130.2.206] (item=/home/ * /myagent/) => {"item": "/home/ * /myagent/", "msg": " ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n", "์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": true}
2018-04-04T21:56:46.8880968Z
2018-04-04T21:56:47.0341093Z ์‹คํŒจ: [10.130.2.206] (item=/home/ * /mywork/) => {"item": "/home/ * /mywork/", "msg": " ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n", "์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": true}
2018-04-04T21:56:47.0349137Z
2018-04-04T21:56:47.0363780Z ์น˜๋ช…์ : [10.130.2.206]: ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {"๋ณ€๊ฒฝ๋จ": false, "msg": "๋ชจ๋“  ํ•ญ๋ชฉ ์™„๋ฃŒ๋จ", "๊ฒฐ๊ณผ": [{"_ansible_ignore_errors": null, "_ansible_item_result": true, "ํ•ญ๋ชฉ": "/home/ * /myagent/" , "msg": "ssh๋ฅผ ํ†ตํ•œ ํ˜ธ์ŠคํŠธ ์—ฐ๊ฒฐ ์‹คํŒจ: ๊ถŒํ•œ ๊ฑฐ๋ถ€(๊ณต๊ฐœ ํ‚ค).\r\n", "unreachable": true}, {"_ansible_ignore_errors": null, "_ansible_item_result": true, "item" : "/home/ * /mywork/", "msg": "ssh๋ฅผ ํ†ตํ•œ ํ˜ธ์ŠคํŠธ ์—ฐ๊ฒฐ ์‹คํŒจ: ๊ถŒํ•œ ๊ฑฐ๋ถ€๋จ(๊ณต๊ฐœ ํ‚ค).\r\n", "unreachable": true}]}
2018-04-04T21:56:47.0371817Z
2018-04-04T21:56:47.0387681Z ์žฌ์‹œ๋„, ์‚ฌ์šฉ: --limit @/tmp/Infrax/Agent_config.retry
2018-04-04T21:56:47.0397434Z
2018-04-04T21:56:47.0403265Z
2018-04-04T21 : 56 : 47.0415230Z์˜ ์žฌ์ƒ RECAP * * * * * * * * * * * * * * * * * * * * *
2018-04-04T21:56:47.0421749Z
2018-04-04T21:56:47.0434107Z 10.130.2.206 : ํ™•์ธ=0 ๋ณ€๊ฒฝ๋จ=0 ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ=1 ์‹คํŒจ=0
2018-04-04T21:56:47.0440861Z
2018-04-04T21:56:47.0446720Z
2018-04-04T21:56:47.0452765Z
2018-04-04T21:56:47.0850279Z ##[์˜ค๋ฅ˜]๋ช…๋ น ansible-playbook -i "10.130.2.206," /tmp/Infrax/Agent_config.yaml -b --become-user * ์ข…๋ฃŒ ์ฝ”๋“œ 4.
2018-04-04T21:56:47.0948275Z ##[์„น์…˜]๋งˆ๋ฌด๋ฆฌ: ํ”Œ๋ ˆ์ด๋ถ ์‹คํ–‰

๋‚ด๊ฐ€ ์ด๊ฒƒ์„ ์ณค์„ ๋•Œ ๋‚˜๋Š” OSX์—์„œ Ansible์„ ์‚ฌ์šฉํ•˜์—ฌ pem ์ธ์ฆ์„œ๊ฐ€ ์žˆ๋Š” aws ์ƒ์ž์— ์—ฐ๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค. ~/.ssh/config ํŒŒ์ผ์ด ์—†์Šต๋‹ˆ๋‹ค. ๋‚ด๊ฐ€ ํ•˜๋‚˜๋ฅผ ๋งŒ๋“ค๊ณ  ์ด๊ฒƒ ์ด์ƒ์„ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์œผ๋ฉด :

์ฃผ์ตœ์ž *
ID ํŒŒ์ผ ~/.ssh/id_rsa
AddKeysToAgent ์˜ˆ

๊ทธ๋Ÿฐ ๋‹ค์Œ ๋‚˜๋Š” ๋งˆ์ˆ ์ฒ˜๋Ÿผ ํ”Œ๋ ˆ์ด๋ถ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

์ œ์–ด ์‹œ์Šคํ…œ์—์„œ ๋…ธ๋“œ๋กœ ํŒŒ์ผ์„ ๋ณต์‚ฌํ•˜๋Š” ๋™์•ˆ ์•„๋ž˜ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

๋ช…๋ น: sudo ansible dbservers -m copy -a "src=/etc/ansible/Taha ๋Œ€์ƒ=/etc/Taha"
์˜ค๋ฅ˜:
52.186.71.70 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

์œ„์— ๋‚˜์—ด๋œ ๋ชจ๋“  ๋‹จ๊ณ„๋ฅผ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์—ฌ์ „ํžˆ ์„ฑ๊ณตํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค....

์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ๊ณผ ssh ํ‚ค๋ฅผ ์‚ฌ์šฉ์ž ์ด๋ฆ„์œผ๋กœ ์ „๋‹ฌํ•ด ๋ณด์‹ญ์‹œ์˜ค. ๋…ธ๋“œ ์ธ๋ฒคํ† ๋ฆฌ์— ์ •์˜๋œ ์‚ฌ์šฉ์ž๊ฐ€ ์—†์œผ๋ฏ€๋กœ ๋ช…๋ น์œผ๋กœ ์ „๋‹ฌํ•˜๋ฉด ํ•ญ์ƒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ช…๋ น์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

sudo ansible dbservers -m -i ์ธ๋ฒคํ† ๋ฆฌ/์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ --user=ubuntu --private-key="private-key.pem" ๋ณต์‚ฌ -a "src=/etc/ansible/Taha ๋Œ€์ƒ=/etc/Taha"

๋„์›€์„ ์ฃผ์‹  Lokesh์—๊ฒŒ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค ...

๋‚˜๋Š” ๊ฐ€๋Šฅํ•œ ๊ฒƒ์— ์ต์ˆ™ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ œ์–ด ์„œ๋ฒ„์—์„œ pem ํŒŒ์ผ์„ ์–ด๋””์— ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค. ์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ์„ ๋ณ€๊ฒฝํ•ด์•ผ ํ•ฉ๋‹ˆ๊นŒ?

์•ˆ๋…•ํ•˜์„ธ์š” ์—ฌ๋Ÿฌ๋ถ„,
๋‚˜๋Š” ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค.
๋‚ด devops ์‚ฌ์šฉ์ž๋Š” ๋ชจ๋“  ์„œ๋ฒ„์— sshํ•  ์ˆ˜ ์žˆ์ง€๋งŒ mysuer๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ€๋Šฅํ•œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ ค๊ณ  ํ•  ๋•Œ ํ•ญ์ƒ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค... UNREACHABLE! ...
"mysuer" ssh serverDestiny(์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ์— ์žˆ๋Š” ์„œ๋ฒ„)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ fqdn์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ FQDN์— ssh๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ•จ์„ ์ฐธ๊ณ ํ•˜์—ฌ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.
์˜ˆ์‹œ:
๊ณ ์–‘์ด ์ธ๋ฒคํ† ๋ฆฌ
์„œ๋ฒ„1

[ myuser@workstation ansible-deploy-cr] ssh-keygen
[ myuser@workstation ansible-deploy-cr] ssh-copy-id -i devops@server1
ํ…Œ์ŠคํŠธ..
[ myuser@workstation ansible-deploy-cr ] ssh ' devops@server1

์ด๊ฒƒ์ด ๋„์›€์ด ๋˜๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.
๊ทธ๋ ‡๋‹ค๋ฉด ์ข‹์•„์š” ๐Ÿ‘
๊ฐ์‚ฌ ํ•ด์š”,
์— ๋ธŒ๋ฆฌํ† 

10.20.2.42
๊ฐ€๋Šฅ ํด๋ผ์ด์–ธํŠธ.com

[๋ฃจํŠธ @ansibleserver ~]# ansible all -m ping
10.20.2.42 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}
๊ฐ€๋Šฅ ํด๋ผ์ด์–ธํŠธ.com | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค, ์•”ํ˜ธ).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}
[ root@ansibleserver ~]#

์ด ๋ฌธ์ œ์— ๋Œ€ํ•ด ์ €๋ฅผ ๋„์™€์ฃผ์„ธ์š”. ssh ํ‚ค๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋‹จ๊ณ„๋ณ„ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์€ ์ „๋ฌธ๊ฐ€๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค.

์นœ์ ˆํ•˜๊ฒŒ ๋„์™€์ฃผ์„ธ์š”

์ด๊ฒƒ์€ ssh ํ‚ค ์ƒ์„ฑ์„ ์„œ๋ฒ„์— ์ถ”๊ฐ€ํ•˜๊ณ  ๋™์ผํ•œ ํ‚ค๋ฅผ ํด๋ผ์ด์–ธํŠธ์— ๋ณต์‚ฌํ•˜์—ฌ ์ˆ˜์ •๋ฉ๋‹ˆ๋‹ค.

๋ช…๋ น:

$ ssh-keygen -t rsa

์—”ํ„ฐ๋ฅผ ์น˜๋‹ค

$ cd ๋ฃจํŠธ/
$ ๋ผ - ๋ผ

๋Œ€์ƒ VM์— id_rsa.pub ๋ณต์‚ฌ
$ssh-copy-id ๋Œ€์ƒ VM

ssh-copy-id -i user@localhost
ssh-copy-id -i user@servers_in_inventory

์ž‘๋™ํ•˜๋Š” ๊ฒƒ ๊ฐ™๋‹ค

์ด URL์€ ์ด ์˜ค๋ฅ˜์— ๋Œ€ํ•œ Google ์กฐํšŒ์ˆ˜ 1์œ„์ด๋ฏ€๋กœ ์ด "๋ฌธ์ œ"๊ฐ€ ํ•ด๊ฒฐ๋œ ๋™์•ˆ์—๋„ ์‚ฌ๋žŒ๋“ค์€ ๊ฐ€๊นŒ์šด ์žฅ๋ž˜์— ์ด ์˜ค๋ฅ˜๋ฅผ ๊ณ„์† ์กฐํšŒํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋‹ค์Œ์€ python3 , ansible 2.5 (๋‘˜ ๋‹ค virutualenv์—์„œ PIP ๋ฒ„์ „์ž„) ๋ฐ OSX High Sierra์— ๋Œ€ํ•ด ์ˆ˜์ •ํ•œ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.
๋‚ด ์‹œ๋‚˜๋ฆฌ์˜ค์— ๋Œ€ํ•œ ๋‚ด '์ˆ˜์ •'๋ณด๊ณ . ๋‹ฌ๋ฆฌ๊ธฐ:
$ python3 $(๊ฐ€๋Šฅ) localhost -m ping -vvvv

์ด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. -vvvv๋Š” ํ‚ค/์ธ์ฆ ์‹คํŒจ์ž„์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ์—„์ฒญ๋‚œ. ๋‹จ์ˆœํžˆ [email protected] ๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ Ansible์„ ์ด๋กœ๋ถ€ํ„ฐ ๋ถ„๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ €์—๊ฒŒ๋Š” ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค(SSH ํ‚ค๋กœ ๋กœ๊ทธ์ธ ์‹คํŒจ๋ฅผ ์‹คํŒจ๋กœ ๊ฐ„์ฃผํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค).

์‰ฌ์šด ์ˆ˜์ •: at ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

๋‚˜๋Š” ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๊ณ  ์Šค์Šค๋กœ ํ•ด๊ฒฐ์ฑ…์„ ์–ป์—ˆ์Šต๋‹ˆ๋‹ค. ๋‚˜์—๊ฒŒ ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๊ณ  ์žˆ๋Š”์ง€ ๋งํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
๋™์ผํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ๋™์ผํ•œ proyect ํด๋”์—์„œ cz๋ฅผ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์ด ์žˆ๊ณ  ์–ด๋–ค ์ด์œ ๋กœ rm -r ํ˜ธ์ŠคํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.
๋‚˜์™€ ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ์•Œ๋ ค๋“œ๋ฆฝ๋‹ˆ๋‹ค.

ํ•ดํ”ผ ํฌ๋ฆฌ์Šค๋งˆ์Šค X), xoxo.

์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ์„ ํŽธ์ง‘ํ•  ๋•Œ๊นŒ์ง€ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
[testserver]
<target_ip> ansible_user=<target_domain_name> ansible_ssh_pass=<target_pass>
๊ทธ๋Ÿฐ ๋‹ค์Œ ํ…Œ์ŠคํŠธํ•˜๋ ค๋ฉด:
ansible testserver -m ping

ubuntu@ip-172-31-1-85 :/etc/ansible$ sudo ansible-playbook tomserver.yml

PLAY [์›น ์„œ๋ฒ„] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **

TASK [์ˆ˜์ง‘ ์‚ฌ์‹ค * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
์น˜๋ช…์ : [54.153.119.230]: ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {"changed": false, "msg": "ssh๋ฅผ ํ†ตํ•œ ํ˜ธ์ŠคํŠธ ์—ฐ๊ฒฐ ์‹คํŒจ: ํ•ด๋‹น ID ์—†์Œ: /root/UbuntuAnsible.pem: ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ ์—†์Œ\r\n๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r \n", "์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": true}
์žฌ์‹œ๋„ํ•˜๋ ค๋ฉด --limit @/etc/ansible/tomserver.retry๋ฅผ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค.

๋„์™€์ฃผ์„ธ์š”

๋‹จ์ˆœํžˆ ์—ฐ๊ฒฐํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๊นŒ? ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์€ ์–ด๋–ป๊ฒŒ ์ƒ๊ฒผ์Šต๋‹ˆ๊นŒ?

2018๋…„ 9์›” 12์ผ ์ˆ˜์š”์ผ, FALCON-SJSU [email protected]
์ผ๋‹ค:

์น˜๋ช…์ : [54.153.119.230]: ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {"๋ณ€๊ฒฝ๋จ": false, "msg": "์‹คํŒจ
ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜๋ ค๋ฉด: ํ•ด๋‹น ID ์—†์Œ: /root/UbuntuAnsible.pem:
ํ•ด๋‹น ํŒŒ์ผ ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.\r\n๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": true}
์žฌ์‹œ๋„ํ•˜๋ ค๋ฉด --limit @/etc/ansible/tomserver.retry๋ฅผ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค.

๋„์™€์ฃผ์„ธ์š”

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/ansible/ansible/issues/19584#issuecomment-420827308 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/An-8H0G3NUSkpFXpcm2hkAXXGco3eMmyks5uaZO0gaJpZM4LSWpz
.

ํ•ด๊ฒฐ์ฑ…์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.
๋‚ด ์šด์˜ ์ฒด์ œ๋Š” Mac OS์˜€์œผ๋ฉฐ 'remote_user = root ' ์ค„์—์„œ 'ansible.cfg'๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ! ๋‚˜๋Š” ๊ฐ™์€ ์ผ์„ํ•ด์•ผํ–ˆ๋‹ค! ํ•ด๊ฒฐํ•˜์…จ๋‹ค๋‹ˆ ๋‹คํ–‰์ž…๋‹ˆ๋‹ค!

2018๋…„ 9์›” 18์ผ ํ™”์š”์ผ ์˜ค์ „ 4:09 ZhangZhongyuan [email protected]
์ผ๋‹ค:

ํ•ด๊ฒฐ์ฑ…์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.
๋‚ด ์šด์˜ ์ฒด์ œ๋Š” Mac OS์ด๊ณ  'ansible.cfg'๋ฅผ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
์ค„ 'remote_user = root ' , ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/ansible/ansible/issues/19584#issuecomment-422297005 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/An-8H0zGJ4zE4mKmaMtXDAtInZNDlrW4ks5ucKpCgaJpZM4LSWpz
.

๋‹ค์Œ ํ”Œ๋ž˜๊ทธ๋กœ ํ”Œ๋ ˆ์ด๋ถ์„ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

sible-playbook playbook.yml --ask-pass - ๋„์›€์ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

ํ˜ธ์ŠคํŠธ์—์„œ ๋‹น์‹ ์€ ๋˜ํ•œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋Œ€์ƒ์˜ ip ์˜†์— ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด
์ถ”๊ฐ€ ์•”ํ˜ธ ํ”„๋กฌํ”„ํŠธ.

2018๋…„ 10์›” 2์ผ ํ™”์š”์ผ ์˜ค์ „ 11:15 jluntnscc [email protected]์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ํ”Œ๋ž˜๊ทธ๋กœ ํ”Œ๋ ˆ์ด๋ถ์„ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

sible-playbook playbook.yml --ask-pass - ๋„์›€์ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/ansible/ansible/issues/19584#issuecomment-426312089 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/An-8HzRVj8-BqcUiQywgQYKIVbcr4yzdks5ug4MEgaJpZM4LSWpz
.

์ด ์‹œ๋„

๋ชจ๋“  ์„œ๋ฒ„ - ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ์˜ ์‚ฌ์šฉ์ž ์ด๋ฆ„์ด ๋™์ผํ•œ ๊ฒฝ์šฐ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค(์•”ํ˜ธ ์—†์Œ).

๊ฐ€๋Šฅํ•œ ๋ชจ๋“  -m ํ•‘

๋ชจ๋“  ์„œ๋ฒ„ - "raj"๋Š” ๊ด€๋ฆฌ ๋…ธ๋“œ์˜ ์‚ฌ์šฉ์ž(์•”ํ˜ธ ์—†์Œ)์ž…๋‹ˆ๋‹ค.

๊ฐ€๋Šฅํ•œ all -u raj -m ping

๋˜๋Š”

๋ฐ๋ชจ ์„œ๋ฒ„ ๊ทธ๋ฃน๋งŒ - "raj"๋Š” ๊ด€๋ฆฌ ๋…ธ๋“œ์˜ ์‚ฌ์šฉ์ž์ž…๋‹ˆ๋‹ค(์•”ํ˜ธ ์—†์Œ).

๊ฐ€๋Šฅํ•œ ๋ฐ๋ชจ ์„œ๋ฒ„ -u raj -m ping

๋˜๋Š”

๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฆ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ

๊ฐ€๋Šฅ -m ping all -u raj --ask-pass

๋˜๋Š” ์ด ๋งํฌ๋ฅผ ๋”ฐ๋ผ๊ฐ€๋ฉด ์ถ”๊ฐ€ ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/install-ansible-automation-tool-for-it-management-on-centos-7-ubuntu-14-04-fedora- 22-ํŒŒํŠธ-1.html

๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ•œ ๊ฒƒ์€ ssh ํ‚ค์— ๋Œ€ํ•œ ๊ฒฝ๋กœ๋ฅผ ๊ฐ–๋„๋ก ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์„ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๊ฒƒ์ด ์—ˆ์Šต๋‹ˆ๋‹ค.

[webserver]
IP_ADDRESS ansible_user=ubuntu ansible_connection=ssh ansible_private_key_file=~/.ssh/key.pem

์ข‹์€ ์†”๋ฃจ์…˜์ž…๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ์—ฌ๋Ÿฌ ๋Œ€์ƒ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค!

2018๋…„ 10์›” 29์ผ ์›”์š”์ผ ์˜คํ›„ 4์‹œ 2๋ถ„ fhackenb [email protected]์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ•œ ๊ฒƒ์€ ssh์— ๋Œ€ํ•œ ๊ฒฝ๋กœ๋ฅผ ๊ฐ–๋„๋ก ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์„ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๊ฒƒ์ด ์—ˆ์Šต๋‹ˆ๋‹ค.
์—ด์‡ :

[์›น ์„œ๋ฒ„]
IP_ADDRESS ansible_user=์šฐ๋ถ„ํˆฌ ansible_connection=ssh ansible_private_key_file=~/.ssh/key.pem

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/ansible/ansible/issues/19584#issuecomment-434057611 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/An-8HzLY4PQVaWdPDOH0bHGnh9xpzmDWks5up17AgaJpZM4LSWpz
.

@riteshpuj2013 ์†”๋ฃจ์…˜ ํ›„์— ์ž˜ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

ansible-playbook test.yml --ask-pass

์ด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ง„ํ–‰ ๋ฐฉ๋ฒ•์„ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค.

ํŒŒ์ด@10.8.0.142 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "์ธ์ฆ ๋˜๋Š” ๊ถŒํ•œ ์‹คํŒจ์ž…๋‹ˆ๋‹ค. ์–ด๋–ค ๊ฒฝ์šฐ์—๋Š” ์ธ์ฆํ•  ์ˆ˜ ์žˆ์—ˆ์ง€๋งŒ ๋Œ€์ƒ ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•œ ๊ถŒํ•œ์ด ์—†์—ˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. asible.cfg์˜ ์›๊ฒฉ tmp ๊ฒฝ๋กœ๋ฅผ \"/tmp์— ๋ฃจํŠธ๋ฅผ ๋‘” ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•˜์‹ญ์‹œ์˜ค. \". ์‹คํŒจํ•œ ๋ช…๋ น: ( umask 77 && mkdir -p \" echo /tmp/.ansible/tmp/ansible-tmp-1543139945.24-52208136278646 \" && echo ansible-tmp-1543139945.24-52208136278646=\" echo /tmp/.ansible/tmp/ansible-tmp-1543139945.24-52208136278646 \" ), ๊ฒฐ๊ณผ 1๊ณผ ํ•จ๊ป˜ ์ข…๋ฃŒ๋จ ",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

๊ฐ€๋Šฅํ•œ ํ”Œ๋ ˆ์ด๋ถ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ๊ฐ€๋Šฅํ•œ ํƒ€์›Œ๋กœ ๋™์ผํ•œ ํ”Œ๋ ˆ์ด๋ถ์„ ์‹คํ–‰ํ•˜๋Š” ๋™์•ˆ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•จ


<192.168.0.17> ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: admin
<192.168.0.17> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=admin -o ConnectTimeout=10 -o ControlPath=/tmp/awx_86_9cdeKb/cp/86796477d7 192.168.0.17 '/bin/sh -c '"'"'echo ~admin && sleep 0'"'" ''
<192.168.0.17> (255, '', "๊ฒฝ๊ณ : ์•Œ๋ ค์ง„ ํ˜ธ์ŠคํŠธ ๋ชฉ๋ก์— '192.168.0.17'(ECDSA)์ด ์˜๊ตฌ์ ์œผ๋กœ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\r\n๊ถŒํ•œ ๊ฑฐ๋ถ€๋จ(publickey,gssapi-keyex,gssapi-with-mic,password ).\r\n")
์น˜๋ช…์ : [192.168.0.17]: ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•œ ํ˜ธ์ŠคํŠธ ์—ฐ๊ฒฐ ์‹คํŒจ: ๊ฒฝ๊ณ : ์•Œ๋ ค์ง„ ํ˜ธ์ŠคํŠธ ๋ชฉ๋ก์— '192.168.0.17'(ECDSA)์ด ์˜๊ตฌ์ ์œผ๋กœ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\r\n๊ถŒํ•œ ๊ฑฐ๋ถ€๋จ(publickey,gssapi-keyex,gssapi-with-mic ,๋น„๋ฐ€๋ฒˆํ˜ธ).\r\n","์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

์ด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์•Œ๋ ค์ฃผ์„ธ์š”.

์šฐ๋ถ„ํˆฌ @master : ~ $ ansible - ๊ฐ๋ณธ playbook2.yml -b PLAY [172.31.42.20] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TASK [ํŒฉํŠธ ์ˆ˜์ง‘] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
์น˜๋ช…์ : [172.31.42.20]: ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {"changed": false, "msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(publickey,password).\r\n", "unreachable": true}
์žฌ ์‹œ๋„์— ์‚ฌ์šฉ : --limit @ / ํ™ˆ / ์šฐ๋ถ„ํˆฌ / playbook2.retry์˜ ์žฌ์ƒ RECAP * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

172.31.42.20 : ํ™•์ธ=0 ๋ณ€๊ฒฝ๋จ=0 ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ=1 ์‹คํŒจ=0

์ด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์•Œ๋ ค์ฃผ์„ธ์š”.

์šฐ๋ถ„ํˆฌ @ ๋งˆ์Šคํ„ฐ : ~ $ ansible - ๊ฐ๋ณธ playbook2.yml -b PLAY [172.31.42.20] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TASK [ํŒฉํŠธ ์ˆ˜์ง‘] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

์น˜๋ช…์ : [172.31.42.20]: ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {"changed": false, "msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(publickey,password).\r\n", "unreachable": true}
์žฌ ์‹œ๋„์— ์‚ฌ์šฉ : --limit @ / ํ™ˆ / ์šฐ๋ถ„ํˆฌ / playbook2.retry์˜ ์žฌ์ƒ RECAP * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
172.31.42.20 : ํ™•์ธ=0 ๋ณ€๊ฒฝ๋จ=0 ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ=1 ์‹คํŒจ=0

์šฐ๋ฆฌ๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋‘ ๊ฐ€์ง€ ์†”๋ฃจ์…˜: -

password less auth (you can refer google how to generate rsa key )
add ask_pass=true in ancible.cfg file. (This will ask password when you run ansible)

ํ˜ธ์ŠคํŠธ ์‹œ์Šคํ…œ์— ๋Œ€ํ•œ SSH ์—ฐ๊ฒฐ์„ ์„ค์ •ํ•˜๊ณ  ํ…Œ์ŠคํŠธํ•˜์‹ญ์‹œ์˜ค.
์™„๋ฃŒ๋˜๋ฉด /etc/ansible/hosts ํŒŒ์ผ์—์„œ ์ ์ ˆํ•œ ํ˜ธ์ŠคํŠธ IP๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
์ด์ œ ๊ฐ€๋Šฅํ•œ ์ปดํ“จํ„ฐ์™€ ๊ฒŒ์ŠคํŠธ ์ปดํ“จํ„ฐ ๊ฐ„์˜ ๋ณด์•ˆ ์—ฐ๊ฒฐ์„ ํ…Œ์ŠคํŠธํ•˜๋ ค๋ฉด ์•„๋ž˜ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค.
-> ๊ฐ€๋Šฅ -i ํ˜ธ์ŠคํŠธ -u ๋ฐฉ๋ž‘์ž --ask-pass -m ๋ชจ๋‘ ํ•‘
ํ˜ธ์ŠคํŠธ-> ํ˜ธ์ŠคํŠธ ํŒŒ์ผ(์ ์ ˆํ•œ ๊ฒŒ์ŠคํŠธ IP ์ œ๊ณต)
-u vagrant -> vagrant๋Š” ๋‚ด ๊ฒŒ์ŠคํŠธ ์ปดํ“จํ„ฐ ์‚ฌ์šฉ์ž ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.
--ask-pass-> ๊ฒŒ์ŠคํŠธ m/c์— ์—ฐ๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด SSH ์•”ํ˜ธ๋ฅผ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ฐธ๊ณ : --ask-pass๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

๋„์›€์ด ๋˜์…จ๋‹ค๋ฉด ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค :)

/etc/ansible/hosts๊ฐ€ ์ž˜๋ชป๋˜์—ˆ์„ ๊ฐ€๋Šฅ์„ฑ์ด ํฝ๋‹ˆ๋‹ค.

๋‚˜๋Š” ๊ฐ€๋Šฅ์— ์ต์ˆ™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๋„ ๋‚˜๋ฅผ ๋„์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

34.201.109.32 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: [email protected] : ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์— ๋Œ€์ƒ ๋จธ์‹ ์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํฌํ•จ์‹œํ‚ค์‹ญ์‹œ์˜ค.
์ผ๋ฐ˜์ ์œผ๋กœ ๊ธฐ์กด ssh ์—ฐ๊ฒฐ์ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
ํ˜ธ์ŠคํŠธ ๋ฐ ๋กœ์ปฌ ์‹œ์Šคํ…œ์— ๋Œ€ํ•œ RSA ํ‚ค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ssh๋ฅผ ์‹œ๋„ํ•˜์‹ญ์‹œ์˜ค
๊ทธ๋Ÿฐ ๋‹ค์Œ ํ˜ธ์ŠคํŠธ๋ฅผ ๋‹ค์‹œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2019๋…„ 1์›” 20์ผ ์ผ์š”์ผ ์˜ค์ „ 11:22 Venkata Bhanusree Vadlamudi <
[email protected]>์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ผ์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ๊ฐ€๋Šฅ์— ์ต์ˆ™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๋„ ๋‚˜๋ฅผ ๋„์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

34.201.109.32 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•œ ํ˜ธ์ŠคํŠธ ์—ฐ๊ฒฐ ์‹คํŒจ: [email protected] :
๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/ansible/ansible/issues/19584#issuecomment-455880089 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/An-8H0nPfSdUELQxzoQAvvHHlsau7uyBks5vFJfOgaJpZM4LSWpz
.

๋กœ์ปฌ ํ„ฐ๋ฏธ๋„์—์„œ ssh ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜๋ฉด ec2 ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ฐ€๋Šฅํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

34.201.109.32 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค: [email protected] : ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

AWS ec2 ์ธ์Šคํ„ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ AWS๋ฅผ ํ†ตํ•ด ๊ณต๊ฐœ ํ‚ค๋ฅผ ์ƒ์„ฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
๊ทธ๊ฒƒ์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ssh ์„ธ์…˜์ด ํ•ด๋‹น ํ‚ค๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์— ๋Œ€ํ•œ ํŠœํ† ๋ฆฌ์–ผ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
์ด ์ ˆ์ฐจ๋ฅผ ์˜จ๋ผ์ธ์œผ๋กœ.

2019๋…„ 1์›” 20์ผ ์ผ์š”์ผ ์˜คํ›„ 4:48 Venkata Bhanusree Vadlamudi <
[email protected]>์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ผ์Šต๋‹ˆ๋‹ค.

๋กœ์ปฌ ํ„ฐ๋ฏธ๋„์—์„œ ssh ๋ช…๋ น์„ ์‚ฌ์šฉํ•  ๋•Œ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
ec2 ์ธ์Šคํ„ด์Šค์—. ๊ทธ๋Ÿฌ๋‚˜ ๊ฐ€๋Šฅํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

34.201.109.32 | ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค! => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"msg": "ssh๋ฅผ ํ†ตํ•œ ํ˜ธ์ŠคํŠธ ์—ฐ๊ฒฐ ์‹คํŒจ: [email protected] :
๊ถŒํ•œ์ด ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค(๊ณต๊ฐœ ํ‚ค).\r\n",
"์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Œ": ์‚ฌ์‹ค
}

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/ansible/ansible/issues/19584#issuecomment-455905472 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/An-8Hya_SkLrHT-HLYEOPEE2QXsSuDOJks5vFOQOgaJpZM4LSWpz
.

์•ˆ๋…•ํ•˜์„ธ์š” ์—ฌ๋Ÿฌ๋ถ„,
๋‚˜๋Š” ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค.
๋‚ด devops ์‚ฌ์šฉ์ž๋Š” ๋ชจ๋“  ์„œ๋ฒ„์— sshํ•  ์ˆ˜ ์žˆ์ง€๋งŒ mysuer๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ€๋Šฅํ•œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ ค๊ณ  ํ•  ๋•Œ ํ•ญ์ƒ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค... UNREACHABLE! ...
"mysuer" ssh serverDestiny(์ธ๋ฒคํ† ๋ฆฌ ํŒŒ์ผ์— ์žˆ๋Š” ์„œ๋ฒ„)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ fqdn์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ FQDN์— ssh๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ•จ์„ ์ฐธ๊ณ ํ•˜์—ฌ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.
์˜ˆ์‹œ:
๊ณ ์–‘์ด ์ธ๋ฒคํ† ๋ฆฌ
์„œ๋ฒ„1

[ myuser@workstation ansible-deploy-cr] ssh-keygen
[ myuser@workstation ansible-deploy-cr] ssh-copy-id -i devops@server1
ํ…Œ์ŠคํŠธ..
[ myuser@workstation ansible-deploy-cr ] ssh ' devops@server1

์ด๊ฒƒ์ด ๋„์›€์ด ๋˜๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.
๊ทธ๋ ‡๋‹ค๋ฉด ์ข‹์•„์š” ๐Ÿ‘
๊ฐ์‚ฌ ํ•ด์š”,
์— ๋ธŒ๋ฆฌํ† 

์ด๊ฒƒ์€ ํ”„๋ผ์ด๋น— VPC์˜ AWS์—์„œ ๋‚ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ์„œ๋ฒ„์— ๋Œ€ํ•ด ๋‚ด๋ถ€ fqdn์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์–˜๋“ค ์•„,
๋‚˜๋Š” localhost์— ๋Œ€ํ•ด ๊ฐ™์€ ๋ฌธ์ œ์— ์ง๋ฉดํ–ˆ๊ณ  '$ ssh localhost'๊ฐ€ ์•”ํ˜ธ๋ฅผ ์š”๊ตฌํ•œ๋‹ค๋Š” ๊ฒƒ์„ ๊นจ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค. localhost์˜ 'user' ๊ณต๊ฐœํ‚ค๋ฅผ authorized_key๋กœ ์˜ฎ๊ฒจ์„œ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

ssh-copy-id -i ~/.ssh/id_rsa.pub test@localhost

authorized_key ํŒŒ์ผ์— ํ•„์š”ํ•œ ํ‚ค๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.

ํ…Œ์ŠคํŠธ๋Š” ์‚ฌ์šฉ์ž ์ด๋ฆ„์ž…๋‹ˆ๋‹ค

์™€.....๋Œ“๊ธ€ ์ž˜ ์ฝ์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ๊ฐ€ ์—ฌ์ „ํžˆ ์กด์žฌํ•œ๋‹ค๋Š” ๊ฒƒ์„ ๋ฏฟ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋‚˜๋Š” ์ตœ์‹  ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ์˜คํ”ˆ ์†Œ์Šค ์‚ฌ์šฉ์˜ ๊ณ ํ†ต ์ค‘ ํ•˜๋‚˜๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

vagrant<strong i="6">@mgmt</strong>:~$ ansible lb -u vagrant -m ping -vvv
ansible 2.7.8
  config file = /home/vagrant/ansible.cfg
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
Using /home/vagrant/ansible.cfg as config file
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths , use [defaults] inventory=/path/to/file|dir 
instead. This feature will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
/home/vagrant/inventory.ini did not meet host_list requirements, check plugin documentation if this is unexpected
/home/vagrant/inventory.ini did not meet script requirements, check plugin documentation if this is unexpected
/home/vagrant/inventory.ini did not meet yaml requirements, check plugin documentation if this is unexpected
Parsed /home/vagrant/inventory.ini inventory source with ini plugin
 [WARNING]: Found both group and host with same name: lb

META: ran handlers
<lb> ESTABLISH SSH CONNECTION FOR USER: vagrant
<lb> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/2302ac11ec lb '/bin/sh -c '"'"'echo ~vagrant && sleep 0'"'"''
<lb> (255, '', 'Permission denied (publickey).\r\n')
lb | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey).", 
    "unreachable": true
}

ํ•ด๊ฒฐ์ฑ…

์ข‹์•„, ์—ฌ๊ธฐ ๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ•œ ๊ฒƒ์ด ์žˆ์Šต๋‹ˆ๋‹ค -
์›๊ฒฉ ์ปดํ“จํ„ฐ lb ์— ๋กœ๊ทธ์ธํ–ˆ์Šต๋‹ˆ๋‹ค. ~/.ssh/authorised_keys๋ฅผ ํŽธ์ง‘ํ•˜๊ณ  ๊ฐ€๋Šฅํ•œ ๋งˆ์Šคํ„ฐ์˜ id_rsa.pub ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ €์žฅํ•˜๊ณ  ์ข…๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค. lb์—์„œ sshd๋ฅผ ๋ฐ˜์†กํ–ˆ์Šต๋‹ˆ๋‹ค.

์ด๊ฒƒ์€ ์™„๋ฒฝํ•œ ๋ฐฉ๋ฒ•์€ ์•„๋‹ˆ์ง€๋งŒ ์ดˆ๊ธฐ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

ํŽธ์ง‘ 1 - ๋˜ํ•œ ์›๊ฒฉ ์‹œ์Šคํ…œ(ansible์— ์˜ํ•ด ๊ด€๋ฆฌ๋  ํด๋ผ์ด์–ธํŠธ)์— python์ด ์„ค์น˜๋˜์–ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ถ”์‹  - ssh-copy-id -i ๋ฐฉ๋ฒ•์กฐ์ฐจ๋„ ๋™์ผํ•œ ๊ถŒํ•œ ๊ฑฐ๋ถ€ ์˜ค๋ฅ˜๋กœ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค (๊ณต๊ฐœ ํ‚ค)

vagrant @mgmt : ~$ ansible lb -m ping -vvv
๊ฐ€๋Šฅํ•œ 2.7.8
์„ค์ • ํŒŒ์ผ = /home/vagrant/ansible.cfg
๊ตฌ์„ฑ๋œ ๋ชจ๋“ˆ ๊ฒ€์ƒ‰ ๊ฒฝ๋กœ = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
์•ค์„œ๋ธ” ํŒŒ์ด์ฌ ๋ชจ๋“ˆ ์œ„์น˜ = /usr/lib/python2.7/dist-packages/ansible
์‹คํ–‰ ์œ„์น˜ = /usr/bin/ansible
ํŒŒ์ด์ฌ ๋ฒ„์ „ = 2.7.12(๊ธฐ๋ณธ๊ฐ’, 2018๋…„ 11์›” 12์ผ, 14:36:49) [GCC 5.4.0 20160609]
/home/vagrant/ansible.cfg๋ฅผ ์„ค์ • ํŒŒ์ผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ
[์‚ฌ์šฉ ์ค‘๋‹จ ๊ฒฝ๊ณ ]: [๊ธฐ๋ณธ๊ฐ’]hostfile ์˜ต์…˜, ํ‚ค๋Š” ํ˜ธ์ŠคํŠธ ๋ชฉ๋ก, ๋””๋ ‰ํ† ๋ฆฌ ๋˜๋Š” ๊ฒฝ๋กœ ๋ชฉ๋ก์ผ ์ˆ˜๋„ ์žˆ์œผ๋ฏ€๋กœ ์˜คํ•ด์˜ ์†Œ์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. [defaults] inventory=/path/to/file|dir ์‚ฌ์šฉ
๋Œ€์‹ ์—. ์ด ๊ธฐ๋Šฅ์€ ๋ฒ„์ „ 2.8์—์„œ ์ œ๊ฑฐ๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ์ค‘๋‹จ ๊ฒฝ๊ณ ๋Š” ansible.cfg์—์„œ deprecation_warnings=False๋ฅผ ์„ค์ •ํ•˜์—ฌ ๋น„ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
/home/vagrant/inventory.ini๊ฐ€ host_list ์š”๊ตฌ ์‚ฌํ•ญ์„ ์ถฉ์กฑํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๊ฒฝ์šฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค๋ช…์„œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.
/home/vagrant/inventory.ini๊ฐ€ ์Šคํฌ๋ฆฝํŠธ ์š”๊ตฌ ์‚ฌํ•ญ์„ ์ถฉ์กฑํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๊ฒฝ์šฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค๋ช…์„œ๋ฅผ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.
/home/vagrant/inventory.ini๊ฐ€ yaml ์š”๊ตฌ ์‚ฌํ•ญ์„ ์ถฉ์กฑํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๊ฒฝ์šฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค๋ช…์„œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.
ini ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์‚ฌ์šฉํ•˜์—ฌ /home/vagrant/inventory.ini ์ธ๋ฒคํ† ๋ฆฌ ์†Œ์Šค๋ฅผ ๊ตฌ๋ฌธ ๋ถ„์„ํ–ˆ์Šต๋‹ˆ๋‹ค.
[๊ฒฝ๊ณ ]: ๊ฐ™์€ ์ด๋ฆ„์˜ ๊ทธ๋ฃน๊ณผ ํ˜ธ์ŠคํŠธ๋ฅผ ๋ชจ๋‘ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. lb

META: ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.
์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: ์—†์Œ
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/e51df67eb4 lb '/bin/sh -c '"'"'์—์ฝ” ~ && ์ ˆ์ „ 0'"'"''
(0, '/์ง‘/๋ฐฉ๋ž‘์ž\n', '')
์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: ์—†์Œ
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/e51df67eb4 lb '/bin/sh -c '"'"'( umask 77 && mkdir -p " echo /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286 " && echo ansible-tmp-1552670816.4-4250286231 =" echo /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286 " ) && ์ ˆ์ „ 0'"'"''
(0, 'ansible-tmp-1552670816.4-42574892310286=/home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286\n', '')
๋ชจ๋“ˆ ํŒŒ์ผ ์‚ฌ์šฉ /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
PUT /home/vagrant/.ansible/tmp/ansible-local-2173_L8KXK/tmpXoK8R8 TO /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286/AnsiballZ_ping.py
SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout= 10 -o ControlPath=/home/vagrant/.ansible/cp/e51df67eb4 '[lb]'
(0, 'sftp> put /home/vagrant/.ansible/tmp/ansible-local-2173_L8KXK/tmpXoK8R8 /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286/'ping ')
์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: ์—†์Œ
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/e51df67eb4 lb '/bin/sh -c '"'"'chmod u+x /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286//home /vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286/AnsiballZ_ping.py && ์ ˆ์ „ 0'"'"''
(0, '', '')
์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: ์—†์Œ
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/e51df67eb4 -tt lb '/bin/sh -c '"'"'/usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4- 42574892310286/AnsiballZ_ping.py && ์ ˆ์ „ 0'"'"''
(0, '\r\n{"invocation": {"module_args": {"data": "pong"}}, "ping": "pong"}\r\n', 'lb์— ๋Œ€ํ•œ ๊ณต์œ  ์—ฐ๊ฒฐ์ด ๋‹ซํ˜”์Šต๋‹ˆ๋‹ค. \r\n')
์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ SSH ์—ฐ๊ฒฐ ์„ค์ •: ์—†์Œ
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/e51df67eb4 lb '/bin/sh -c '"'"'rm -f -r /home/vagrant/.ansible/tmp/ansible-tmp-1552670816.4-42574892310286/ > /dev/null 2>&1 && ์ ˆ์ „ 0'"'"''
(0, '', '')
ํŒŒ์šด๋“œ | ์„ฑ๊ณต => {
"๋ณ€๊ฒฝ๋œ": ๊ฑฐ์ง“,
"ํ˜ธ์ถœ": {
"module_args": {
"๋ฐ์ดํ„ฐ": "ํ"
}
},
"ํƒ๊ตฌ"
}

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰