|
1 | 1 | ### create a user on all machines ( controller & all targets )
|
2 | 2 |
|
3 |
| - useradd botuser -m -d /home/botuser -s /bin/bash |
| 3 | + useradd naresh -m -d /home/naresh -s /bin/bash |
4 | 4 |
|
5 | 5 | ### add user to sudoers for root previliges on all machines ( all targets )
|
6 | 6 |
|
7 |
| - echo -e 'botuser ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/botuser |
| 7 | + echo -e 'naresh ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/naresh |
8 | 8 |
|
9 | 9 | ### genereate ssh keys for above user on contrller machine
|
10 | 10 |
|
11 | 11 | ```
|
12 |
| - 1) switch to user ( su - botuser ) |
| 12 | + 1) switch to user ( su - naresh ) |
13 | 13 | 2) run "ssh-keygen" command as user ( this will genereate ssh keys for the user )
|
14 | 14 | ```
|
15 |
| - |
16 |
| -### copy user ssh keys from ansible contrller to all target hosts |
17 |
| - |
18 | 15 | ```
|
19 |
| - 1) on ansible controller machine |
20 |
| - cd /home/botuser/.ssh |
| 16 | + on ansible controller machine |
| 17 | + cd /home/naresh/.ssh |
21 | 18 | cat id_rsa.pub (copy the content)
|
22 | 19 | ```
|
| 20 | +### copy user ssh keys from ansible contrller to all target hosts |
| 21 | + |
23 | 22 | ```
|
24 |
| - 2) on all taget machines |
25 |
| - swith to the user ( su - botuser ) |
26 |
| - mkdir -p /home/botuser/.ssh |
27 |
| - touch /home/botuser/.ssh/authorized_keys |
28 |
| - chmod -R 700 /home/botuser/.ssh |
29 |
| - vi /home/botuser/.ssh/authorized_keys (enter the copied contet of id_rsa.pub from controller & save the file) |
| 23 | + 1) on all target machines |
| 24 | + swith to the user ( su - naresh ) |
| 25 | + mkdir -p /home/naresh/.ssh |
| 26 | + touch /home/naresh/.ssh/authorized_keys |
| 27 | + chmod -R 700 /home/naresh/.ssh |
| 28 | + vi /home/naresh/.ssh/authorized_keys (enter the copied contet of id_rsa.pub from controller & save the file) |
30 | 29 | ```
|
31 | 30 |
|
32 | 31 |
|
0 commit comments