Using SSH-Key Authentication

To use key authentication, you must provide the SSH key file used in all the cluster servers to the hosts file, which is usually located from the light-app directory in this path: ansible/inventories/cluster_example/hosts.

To use SSH-key authentication instead of a plain text password, see the knowledge base article How To Configure SSH Key-Based Authentication on a Linux Server.

After you have configured the SSH key for authentication, you can connect from the installation server to the target with the ansible_ssh_private_key_file instead ofansible_ssh_pass, in the following format:

Bash
Copy

With the default configuration, the top section of the hosts file lines are configured as below:

Bash
Copy

As an example, assume that the SSH key for the servers is located at /root/mykey.txt. If so, change the configuration line to this:

Bash
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard