Ansible Script 추가
This commit is contained in:
9
ansible/01_old/ssh_key/README.md
Normal file
9
ansible/01_old/ssh_key/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# ssh key 배포 installer
|
||||
|
||||
# authorized_keys.yaml은 client에 ssh-pass가 설치되어 있어야 해서 일단 미사용
|
||||
|
||||
1. 사전 작업
|
||||
- ssh-keygen
|
||||
|
||||
2. 명령어
|
||||
- ./key.sh <PASSWORD> <IPADDR>
|
||||
11
ansible/01_old/ssh_key/authorized_keys.yml
Normal file
11
ansible/01_old/ssh_key/authorized_keys.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
- hosts: cluster
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: key add
|
||||
authorized_key:
|
||||
user: root
|
||||
state: present
|
||||
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
|
||||
manage_dir: False
|
||||
|
||||
32
ansible/01_old/ssh_key/ip_list
Normal file
32
ansible/01_old/ssh_key/ip_list
Normal file
@@ -0,0 +1,32 @@
|
||||
10.10.43.111
|
||||
10.10.43.112
|
||||
10.10.43.113
|
||||
10.10.43.114
|
||||
10.10.43.115
|
||||
10.10.43.116
|
||||
10.10.43.117
|
||||
10.10.43.118
|
||||
10.10.43.119
|
||||
10.10.43.120
|
||||
10.10.43.121
|
||||
10.10.43.122
|
||||
10.10.43.123
|
||||
10.10.43.124
|
||||
10.10.43.125
|
||||
10.10.43.126
|
||||
10.10.43.127
|
||||
10.10.43.128
|
||||
10.10.43.129
|
||||
10.10.43.130
|
||||
10.10.43.131
|
||||
10.10.43.132
|
||||
10.10.43.133
|
||||
10.10.43.134
|
||||
10.10.43.135
|
||||
10.10.43.136
|
||||
10.10.43.137
|
||||
10.10.43.138
|
||||
10.10.43.139
|
||||
10.10.43.140
|
||||
10.10.43.141
|
||||
10.10.43.142
|
||||
8
ansible/01_old/ssh_key/key.sh
Executable file
8
ansible/01_old/ssh_key/key.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/expect -f
|
||||
set password [lindex $argv 0]
|
||||
set host [lindex $argv 1]
|
||||
|
||||
spawn ssh-copy-id -o StrictHostKeyChecking=no root@$host
|
||||
expect "password:"
|
||||
send "$password\n"
|
||||
expect eof
|
||||
8
ansible/01_old/ssh_key/test.sh
Executable file
8
ansible/01_old/ssh_key/test.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
while read ip
|
||||
do
|
||||
./key.sh saasadmin1234 ${ip}
|
||||
done < ip_list
|
||||
|
||||
Reference in New Issue
Block a user