Hosts Config
how you config hosts.yaml file.
Last updated
Was this helpful?
how you config hosts.yaml file.
Last updated
Was this helpful?
Was this helpful?
all:
- hostname: "192.168.22.226"
username: "root"
password:
port: "22"
- hostname: "192.168.22.227"
username: "root"
pem_file: /path/your.pem
port: "22"
web_server:
- hostname: "192.168.68.101"
username: "root"
password: "root"
db_server:
- hostname: "192.168.68.102"
username: "root"
password: "root"
all: This section defines configurations for all-purpose servers. It includes two server configurations:
Server 1: "192.168.22.226," where you specify the hostname, the username ("root"), but you didn't provide a password, and the SSH port is set to the default "22."
Server 2: "192.168.22.227," where you specify the hostname, the username ("root"), and a PEM file for SSH key-based authentication. The SSH port is again set to "22."
web_server: This section defines the configuration for a web server with the IP address "192.168.68.101." It includes the hostname, username ("root"), and password ("root").
db_server: This section defines the configuration for a database server with the IP address "192.168.68.102." It also includes the hostname, username ("root"), and password ("root").
all, web_server and db_server is group name of your servers IP
This YAML structure is suitable for specifying SSH connection details for multiple servers. You can use this configuration with automation tools like Ansible or scripts to manage these servers and perform tasks like provisioning, configuration, and maintenance. Ensure that you provide the missing password or key file where necessary for successful SSH authentication.