보조기억장치
ansible 설정 본문
ssh 접속 테스트
# ssh 192.168.0.112
# ssh 192.168.0.113
$ ls -la .ssh
known_hosts
ssh 공개키 생성
# ssh-keygen -t ed25519 -C 'server default'
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/jay/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jay/.ssh/id_ed25519.
Your public key has been saved in /home/jay/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:oUFqAo7n039pjrzXwlYLVX+pTK+zQMqOroKbxt8UlQg raritan default
The key's randomart image is:
+--[ED25519 256]--+
|. E . |
|o. .o. . . |
|..o o..o. . . .|
| o + .o .. ....|
| o ... S. .o o. |
| . .. o.+ o . |
|. . ...+* o . |
| +..o. =B o .o |
|.oo..o**.o .o |
+----[SHA256]-----+
# ls -al .ssh
id_ed25519 (개인키)
id_ed25519.pub (공개키)
known_hosts
ssh 공개키 복사
# ssh-copy-id -i ~/.ssh/id_ed25519.pub 192.168.0.112
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/jay/.ssh/id_ed25519.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
jay@192.168.0.112's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.0.112'"
and check to make sure that only the key(s) you wanted were added.
2번 서버 확인
# ls -al .ssh
authorized_keys 파일 생성됨
ssh 접속확인
# ssh 192.168.0.112
Enter passphrase for key '/home/jay/.ssh/id_ed25519':
ansible 전용키 생성
# ssh-keygen -t ed25519 -C "ansible"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/jay/.ssh/id_ed25519): /home/jay/.ssh/ansible (경로 지정)
Enter passphrase (empty for no passphrase): 암호생략
Enter same passphrase again: 암호생략
Your identification has been saved in /home/jay/.ssh/ansible.
Your public key has been saved in /home/jay/.ssh/ansible.pub.
The key fingerprint is:
SHA256:we85yZYp5ebTW+j69N7hb7YhrvAdA3ixc8UUWUSSJRU ansible
The key's randomart image is:
+--[ED25519 256]--+
| oE@|
| . ++ |
| o . o |
| o. o . |
| S.o= . |
| =.=+. |
| ..%.o+.o |
| =+++o=.=|
| o*==o==|
+----[SHA256]-----+
ansible 키 복사
# ssh-copy-id -i ~/.ssh/ansible.pub 192.168.0.112
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/jay/.ssh//ansible.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Enter passphrase for key '/home/jay/.ssh/id_ed25519':
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.0.112'"
and check to make sure that only the key(s) you wanted were added.
ansible 키로 ssh 접속테스트
# ssh -i ~/.ssh/ansible 192.168.0.112
Activate the web console with: systemctl enable --now cockpit.socket
암호없이 편리하게 접속하기 (터미널 종료시 까지)
# eval $(ssh-agent)
Agent pid 33405
# ps aux |grep 33405
jay 33405 0.0 0.0 27424 524 ? Ss 00:31 0:00 ssh-agent
jay 33423 0.0 0.0 10572 1156 pts/0 S+ 00:31 0:00 grep --color=auto 33405
# ssh-add
Enter passphrase for /home/jay/.ssh/id_ed25519:
Identity added: /home/jay/.ssh/id_ed25519 (server default)
# ssh 192.168.0.112 (암호없이 바로 접속됨)
alias 만들기(.bashrc 추가)
# alias ssha='eval $(ssh-agent) && ssh-add'
git 저장소 복사
# git clone git@github.com:cathaynow/ansible_examples.git .
'ansible_examples'에 복제합니다...
...생략...
git 환경설정
# git config --global user.name 'Cathay'
# git config --global user.email "dodeux81@gmail.com"
# cat ~/.gitconfig
[user]
name = Cathay
email = dodeux81@gmail.com
git 테스트
# nano README.md 수정
# git status
# git diff
커밋추가
# git add README.md
# git status
# git commit -m "updated readmin file, initial commit"
# git push origin main
'Linux' 카테고리의 다른 글
ubuntu apt update 에러 (0) | 2023.05.09 |
---|---|
ansible 테스트 (0) | 2023.05.08 |
Module yaml error: Unexpected key in data: static_context [line 9 col 3] 에러 (0) | 2023.04.20 |
Bash 예제 (0) | 2023.04.18 |
package ansible-6.3.0-2.el8.1.noarch requires python3.9dist(ansible-core) >= 2.13.3, but none of the providers can be installed (0) | 2023.04.06 |