配置ymal文件
创建密钥
[xiaoxin@iZ2zee6df2m25shq6mfaw5Z ansible]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/xiaoxin/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/xiaoxin/.ssh/id_rsa. Your public key has been saved in /home/xiaoxin/.ssh/id_rsa.pub. The key fingerprint is: SHA256:30sWAZHzKe5dzDBK6YpZFIHKoI6lFUi2ljh2iouYL04 xiaoxin@iZ2zee6df2m25shq6mfaw5Z The key's randomart image is: +---[RSA 2048]----+ |.+ ...oo | |+ = . . o. | |o* = . . +.. | |=.= o . + =. | |+= .S+ o.= | |=+ ..+. .+ | |=E + o..+. | |o. o . .o.. | |.o. . | +----[SHA256]-----+
执行免密
[xiaoxin@iZ2zee6df2m25shq6mfaw5Z ansible]$ ansible-playbook install_xiaoxin.ymal --extra-vars "ansible_ssh_user=root" PLAY [d] ************************************************************************************************************************* TASK [Gathering Facts] *********************************************************************************************************** ok: [10.1.1.83] ok: [10.1.1.82] ok: [10.1.1.76] ok: [10.1.1.75] ok: [10.1.1.77] ok: [10.1.1.78] ok: [10.1.1.79] ok: [10.1.1.80] ok: [10.1.1.81] TASK [copy ssh key] ************************************************************************************************************** changed: [10.1.1.76] changed: [10.1.1.83] changed: [10.1.1.82] changed: [10.1.1.75] changed: [10.1.1.77] changed: [10.1.1.78] changed: [10.1.1.79] changed: [10.1.1.80] changed: [10.1.1.81] PLAY RECAP *********************************************************************************************************************** 10.1.1.75 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.76 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.77 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.78 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.79 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.80 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.81 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.82 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.1.1.83 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
验证
继续阅读
- 我的QQ
- QQ扫一扫
-
- 我的头条
- 头条扫一扫
-
评论