Last active
August 29, 2015 14:15
-
-
Save isopan/a5c1bca7ae7ebd10688e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////ansibleサーバー、ansibleクライアントで実行 | |
//ユーザーの作成 | |
# groupadd ansible | |
# useradd ansible -g ansible | |
/////ansibleサーバーで実行 | |
//パスワードなしキー作成 | |
# su - ansible | |
$ sudo yum install ansible | |
$ cd /home/ansible/.ssh/ | |
$ ssh-keygen -t rsa | |
$ ls | |
id_rsa id_rsa.pub | |
$ vi config | |
Host 192.168.1.2 | |
HostName 192.168.1.2 | |
IdentityFile ~/.ssh/id_rsa | |
User ansible | |
$ scp ./id_rsa.pub ansible@192.168.1.2:/home/ansible/.ssh/ | |
/////ansibleクライアントで実行 | |
//鍵を設定 | |
# su - ansible | |
$ cd /home/ansible/.ssh/ | |
$ cat id_rsa.pub >> authorized_keys | |
$ chmod 0600 authorized_keys | |
$ exit | |
//ansibleユーザーにsudo権限を付与 | |
# visudo | |
ansible ALL=(ALL) NOPASSWD: ALL | |
/////ansibleサーバーで実行 | |
$ ansible 192.168.1.2 -m ping | |
192.168.1.2 | success >> { | |
"changed": false, | |
"ping": "pong" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment