Ansible implement the login password-free batch

If the machine is more, if a hundred servers, each server had to enter before login yes, use interactive mode if it is made public under trouble (ssh-copy-id).

  1. The first operation requires a password to operate the server, so the configuration files need to configure password
  2. ansible achieve volume issued public
    ansible all -m shell -a "pubkey=$(cat /root/.ssh/id_rsa.pub);cd /root/; umask 077; test -d .ssh || mkdir .ssh ;echo $pubkey >> .ssh/authorized_keys"

    way, the key to the success of the batch distribution, in the configuration file, the password can be configured to removed.

    Be sure to keep it private, no special password private key.

Guess you like

Origin www.cnblogs.com/dhzg/p/11408575.html