Connecting to remote nodes
It is the best practice to use dynamic inventories to avoid frequent changes in static inventory files. However, this depends on your environment. It is also a best practice to separate inventory files based on environment, criticality, or other parameters. The following screenshot shows sample inventory files based on the workload environment. As you can see, there are different directories and files for production, development, and staging devices:
Figure 2.22 – Ansible inventory separation based on environment
You need to ensure that the Ansible control node to managed nodes connection is safe and secure. For Linux/Unix managed nodes, use the ssh
connection (which is the default connection method) with key-based authentication, as explained in Chapter 1's, Configuring Your Managed Nodes section. There might be cases where you cannot use SSH keys. In that case, you can use encrypted passwords with a username for authentication...