Showing posts with label Salt SSH. Show all posts
Showing posts with label Salt SSH. Show all posts

Monday, 11 March 2019

Salt SSH for agentless login on AWS server by Raj Gupta


Update the server
yum update

install epel
sudo amazon-linux-extras install epel
yum install epel-release -y

now install Salt-SSH
yum install salt-ssh salt-master -y

Now update the file with client details
ls -l /etc/salt/roster
vim /etc/salt/roster

appserver1:
  host: 192.168.1.210
  user: root
  passwd: root123           ------set the root password of client by using command passwd
  port: 22
appserver2:
  host: 192.168.1.230
  user: root
dbserver1:
  host: 192.168.1.220
  user: root
  sudo: True
  tty: True

 check the updated file
cat -vet /etc/salt/roster

now enable and start the salt master
systemctl enable salt-master
systemctl start salt-master
systemctl status salt-master
salt-ssh --version-report


vi /etc/ssh/sshd_config     ----- in this file change the below line for password logging in both client and master
PasswordAuthentication yes      ------here change no to yes

now start the service
systemctl restart sshd

salt-ssh -i '*' test.ping                   ------to check connectivity
salt-ssh '*' cmd.run 'df -h;date'         -------to run shell command
salt-ssh '*' cmd.run 'df -h;date' -l debug         ------to debug how the command are running